MAPK MAPK - 2 months ago 7
R Question

How to plot range of values in R

I have this Rdata:

load(url('https://dl.dropboxusercontent.com/u/43417085/density_plot.RData'))


I want to plot a density graph something like this, where I can see range of values in
want.IBS
column spanning for each
cutoff
items. Also, my X-axis should be between -2 to 2 and Y-axis should have cutoff items only (not the numerical values).

This is what I tried, but all I can see is dark lines. Is there any other method to do this?

p <- ggplot(mymat, aes(x=as.numeric(want.IBS), fill=cutoff)) #as suggested
p <- p + geom_density(alpha=0.5)
p <- p + xlab ("IBD") + ylab("cutoff")
p <- p + theme_bw()
p

Answer
mm<-mymat[,2:3]
dd<-melt(mm, id.vars=c("cutoff"))
ggplot(dd, aes(x= as.numeric(value), fill=cutoff))+
   geom_density(alpha=0.5)
   +xlab ("IBD") + ylab("cutoff")+theme_bw()

enter image description here

Comments