Mercurial > repos > moheydarian > ggplot_histogram
diff ggplotscripthistogram.R @ 15:19546f3ef70a draft
Uploaded
| author | moheydarian |
|---|---|
| date | Tue, 11 Apr 2017 16:43:46 -0400 |
| parents | ed06f51b00ef |
| children | 9577cd390ee6 |
line wrap: on
line diff
--- a/ggplotscripthistogram.R Tue Apr 11 16:43:35 2017 -0400 +++ b/ggplotscripthistogram.R Tue Apr 11 16:43:46 2017 -0400 @@ -37,6 +37,7 @@ 'dim', 'k', 2, 'character', 'scaling', 'j', 2, 'character', 'legend', 'l', 2, 'character', + 'density', 'm', 2, 'character', 'output', 'o', 2, 'character' ), byrow=TRUE, ncol=4); @@ -65,6 +66,13 @@ gg_legend = theme(legend.position="none") } +#density +if(options$density == "counts"){ + gg_density = NULL +} else { + gg_density = , ...density..., +} + #Choose between automatically scaled x and y axis or user defined if(options$scaling == "Automatic"){ gg_scalex = NULL @@ -112,7 +120,7 @@ gg_colorscale = scale_color_brewer(palette=options$colors, direction=options$colororder) } -ggplot(input,aes(value,color=variable)) + +ggplot(input,aes(value gg_density,color=variable)) + geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+ gg_scalex+gg_scaley+theme_bw()+xlab(options$xlab)+ylab(options$ylab)+gg_legend+ ggtitle(options$title)
