Skip to content

Instantly share code, notes, and snippets.

@luisDVA
Last active August 28, 2015 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisDVA/ff21825cfd05003c3a60 to your computer and use it in GitHub Desktop.
Save luisDVA/ff21825cfd05003c3a60 to your computer and use it in GitHub Desktop.
download and plot section length data
#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