Skip to content

Instantly share code, notes, and snippets.

@mbk0asis
Last active May 10, 2018 02:51
Show Gist options
  • Save mbk0asis/41845bdfc9eb6344e153 to your computer and use it in GitHub Desktop.
Save mbk0asis/41845bdfc9eb6344e153 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(ggpmisc)
p <- ggplot(df2,aes(log2(df2$high_mean),log2(df2$low_mean)),
xlab="log2(Setdb1_high)", ylab="log2(Setdb1_low)")
p + xlim(0,10) + ylim(0,10)+ theme_bw() +
geom_point(size=1,alpha=.3,col="black") +
stat_density2d(aes(fill=..level..,alpha=..level..),geom='polygon',colour='grey50',bins=10, show.legend = F) +
scale_fill_continuous(low="yellow",high="red") +
stat_poly_eq(formula = my.formula,
aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~~~~~~~~~"),size=4),
parse = TRUE) +
geom_abline(intercept = 0,linetype="dashed",size=1.2,col="black") + guides(fill=FALSE) +
geom_smooth(method = "lm", formula = y ~ x, se = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment