# HG changeset patch # User moheydarian # Date 1491948170 14400 # Node ID b212836e738d231d9c0ca44beeb6f09bcb05801a # Parent e4b2d12f46917286acbb7f603c20872a862f81e3 Uploaded diff -r e4b2d12f4691 -r b212836e738d ggplotscripthistogram.R --- a/ggplotscripthistogram.R Tue Apr 11 17:17:38 2017 -0400 +++ b/ggplotscripthistogram.R Tue Apr 11 18:02:50 2017 -0400 @@ -69,10 +69,13 @@ #density if(options$density == "counts"){ gg_density = ggplot(input,aes(value ,color=variable)) - -} else { + gg_freq = NULL +} else if(options$density == "ndensity"){ gg_density = ggplot(input,aes(value, ..ncount..,color=variable)) - + gg_freq = NULL +} else if(options$density == "density"){ + gg_density = ggplot(input,aes(value,color=variable)) + gg_freq = aes(y=..count../sum(..count..)) } #Choose between automatically scaled x and y axis or user defined @@ -123,7 +126,7 @@ } gg_density + -geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+ +geom_freqpoly(gg_freq,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)