[R] GGplot annotate by facet

John Kane jrkrideau at inbox.com
Sat Sep 10 14:42:21 CEST 2016


Hi Saad,

Please have a look at 

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and/or
http://adv-r.had.co.nz/Reproducibility.html

for some suggestions on how to ask a question on R-help

In particular it would be handy to have some sample data in dput() format.

I always mess up geom_bar() calls and at the moment don't understand exactly what you are doing here qplot(factor(Value),data=dat1,
      geom="bar",fill=factor(Type))


John Kane
Kingston ON Canada


> -----Original Message-----
> From: smk5g5 at mail.missouri.edu
> Sent: Sat, 10 Sep 2016 01:55:18 +0000
> To: r-help at r-project.org
> Subject: [R] GGplot annotate by facet
> 
> Hi,
> 
> I have a dataframe which I need to plot in ggplot2 it looks like this :-
> 
> head(nodelta_firstexon)
>   Value Type  Histone
> 1  0.06 high  H3K27ac
> 2  0.12  low  H3K27ac
> 4  0.04 high H3K27me3
> 5  0.16  low H3K27me3
> 7  0.02 high H3K36me3
> 8  0.13  low H3K36me3
> 
> I have another data frame with p-v alues that looks like this :-
> 
> 
> head(mypval_df)
> 
>   Histone count pvalues
> 
> 1   H3K9ac     0   0.000
> 
> 2 H3K27me3     0   0.000
> 
> 3 H3K36me3  1000   1.000
> 
> 4  H3K4me3   583   0.583
> 
> 5  H3K4me1   882   0.882
> 
> 6  H3K27ac   970   0.970
> 
> This is how I plot the first dataframe  using ggplot
> p <-
> qplot(factor(Value),data=nodelta_firstexon,geom="bar",fill=factor(Type))+facet_wrap(~Histone)
> 
> Next I need to annotate p-values (p <= mypval_df$pvalues)  to each facet
> using the mypval_df.
> 
> I can't seem to find an example on how to do it. Would appreciate any
> help.
> 
> Regards
> Saad
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.



More information about the R-help mailing list