Last active
August 28, 2015 20:57
-
-
Save luisDVA/ff21825cfd05003c3a60 to your computer and use it in GitHub Desktop.
download and plot section length data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Package load | |
library(dplyr) | |
library(reshape2) | |
library(ggplot2) | |
library(devtools) | |
install_github('timcdlucas/palettetown') | |
library(palettetown) | |
# read the data directly from the repo | |
jrnDatacomp<- read.csv("https://raw.githubusercontent.com/luisDVA/codeluis/master/paperStructure.csv") | |
# data wrangling | |
jrnData <- select(jrnDatacomp, | |
-study, | |
-link) %>% | |
group_by(jrnl) %>% | |
summarise_each(funs(mean)) %>% | |
melt() %>% arrange(jrnl) | |
jrnDataSD <- select(jrnDatacomp, | |
-study, | |
-link) %>% | |
group_by(jrnl) %>% | |
summarise_each(funs(sd)) %>% | |
melt(value.name = "sd") %>% arrange(jrnl) | |
#organize for plotting | |
forplot <- inner_join(jrnData,jrnDataSD) | |
forplot$variable <- factor(forplot$variable,levels=rev(levels(forplot$variable))) | |
# plot dot-whisker figure using the colors of Jigglypuff | |
ggplot(forplot,aes(x=variable,y=value, ymin = value - sd/2, ymax = value + sd/2))+ | |
geom_point(aes(color=jrnl,size=3),position=position_dodge(width = 0.7))+ | |
geom_linerange(aes(color=jrnl,size=2),position=position_dodge(width = 0.7))+ | |
theme_light()+scale_colour_poke(pokemon = 39,spread=6)+ | |
scale_y_continuous(breaks=seq(0,2500,250))+ | |
theme(panel.grid.major.x=element_blank(), | |
panel.grid.minor.x=element_blank(), | |
panel.grid.minor.y=element_blank(), | |
panel.grid.major.y=element_blank())+ | |
coord_flip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment