[R] creating a figure with different shades in R?

Wei Ding wei.ding at student.uni-tuebingen.de
Wed Feb 12 10:51:22 CET 2014


Hello, everyone, I have following csv-file(simplified) as instance:


0.29,2,50
0.32,3,10
0.28,4,71
0.27,1,62
0.53,1,33
0.83,5,100

with the first column for x-axis (proportion shared), the second for  
y-axis (number of shared segments), the shades for 'number of pairs'.


I wonder how to realize that the "number of pairs" are denoted by  
different shades as shown in the attachment ? So far, I can plot a  
histogram by these codes, but have no idea how to correctly add  
information of shades to it.

df<-read.csv(file="c-all-prop-test.csv",head=F,sep=",")
require(ggplot2)
qplot(x=df[,1],weight=df[,2],geom="histogram",xlab="proportion  
shared",ylab="number of shared segments",colour = I("darkgreen"), fill  
= I("blue"))

It seems that d + stat_bin2d() may help. Or maybe heatmap?

Could you give me some suggestions? Best regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: R.png
Type: image/png
Size: 21362 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140212/75ac7b7c/attachment.png>


More information about the R-help mailing list