Skip to content

Instantly share code, notes, and snippets.

@sashaphanes
Last active December 17, 2015 04:29
Show Gist options
  • Save sashaphanes/5550745 to your computer and use it in GitHub Desktop.
Save sashaphanes/5550745 to your computer and use it in GitHub Desktop.
#A solution with ggplot2
#library(reshape2)
#test.m <- melt(test)
#sample of dataframe:
head(combined.data)
> region expression species
1 NAc 0.4711284 macaque
2 NAc -0.1003201 macaque
3 Pu -0.3629559 macaque
4 Caud -0.3749001 macaque
5 GPe -0.5241925 macaque
6 GPi -0.5855168 macaque
#Plot the data:
ggplot(combined.data, aes(x = region, y = expression, fill = species)) +
+ geom_boxplot() +
+ scale_fill_manual(values = c("yellow", "orange"))
+ ggtitle("MAOA expression in human vs. macaque")
+ theme(axis.text.x = element_text(angle=90, face="bold", colour="black"))
#http://stackoverflow.com/questions/14608422/box-plots-for-groups
#http://stackoverflow.com/questions/7883190/how-to-display-two-groups-of-boxplots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment