V1 V2 V3 hcg hmeth mch mmeth class h_m
1 chr1 884000 885000 107 0.0105356 55 0.00406504 M 0.2890211
2 chr1 885000 886000 103 0.0158201 30 0.01015230 M 0.5357160
3 chr1 886000 887000 119 0.0170750 36 0.41832700 L 0.5192445
4 chr1 887000 888000 50 0.5725810 16 0.94303800 L 0.4948500
5 chr1 888000 889000 51 0.8819190 29 0.95502600 M 0.2451722
6 chr1 889000 890000 73 0.8581730 21 0.94063900 M 0.5411036
pdf("Human_mouse_cg.pdf")
ggplot(tmp, aes(x=h_m, colour=class)) + geom_density(adjust=5)
dev.off()
where the adjust option adjusts the smoothness of the density plot.
http://had.co.nz/ggplot2/stat_density.html
Change axis labels
By default, ggplot uses the variable name as the axis labels. Change it to something else using scale_x_continuous or
scale_y_continuous
p = ggplot(diamonds)+geom_point()+aes(x=carat,y=price)
p + scale_x_continuous('x axis label') + scale_y_continuous('y axis label')
Colors
look at here:
http://wiki.stdout.org/rcookbook/Graphs/Colors%20(ggplot2)/