jeudi 26 juin 2014

R ggplot2 boxplot with multiple x variables


Vote count:

0




I'm pretty new to R and am having a few issues with drawing graphs using ggplot2.


This is an example of my data : logpvalue (13.45,12.57,3.21,6.24) SNP (rs3087967,rs3087967,rs7130173,rs7130173) 173 (het, hom, het, hom)


I want to plot a boxplot of logpvalue on y axis, with SNP on the x-axis but with each each SNP also categorized by whether the patient is het or hom for 173. So from this data I'd imagine 4 boxes on my boxplot.


If possible I'd also like to incorporate the individual data points (dotplot-boxplot overlay) with jitter.


This is the usual code I'd use for a boxplot of logpavlue vs SNP:



qplot(logpvalue, SNP, data = mydata, geom="boxplot")
+ geom_jitter(position=position_jitter(w=0.1, h=0.1)) + theme_bw()


Can anyone help me add the extra x variable into this code? Thanks!



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire