Skip to content

Instantly share code, notes, and snippets.

@cdiener
Last active August 29, 2015 14:20
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 cdiener/f5fe3d166eb6b5c2e959 to your computer and use it in GitHub Desktop.
Save cdiener/f5fe3d166eb6b5c2e959 to your computer and use it in GitHub Desktop.
ggplot2 grouped points with horizontal means
library(scales)
library(Hmisc)
emsa_plot = ggplot(emsa, aes(x=Name, y=intensity, shape=charge_ratio, col=charge_ratio, width=0.8)) +
geom_point(size=3, position=position_dodge(width=0.8)) +
stat_summary(fun.data=mean_sdl, mult=0, color="black", geom="errorbar", size=1, position=position_dodge(width=0.8)) +
scale_color_grey(start=0, end=0.5,name="charge ratio") +
scale_shape(name="charge ratio") +
scale_y_continuous(limits=c(-0.05,1), breaks=seq(0,1,by=0.2), label=percent) +
xlab("") + ylab("DNA retention (%)") + pub_theme +
theme(axis.text.x = element_text(angle=45, hjust=1), legend.position=c(0.5,0.25))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment