Mercurial > repos > moheydarian > ggplot_histogram
comparison ggplotscripthistogram.R @ 16:9577cd390ee6 draft
Uploaded
| author | moheydarian |
|---|---|
| date | Tue, 11 Apr 2017 16:51:37 -0400 |
| parents | 19546f3ef70a |
| children | 064d7ad9968d |
comparison
equal
deleted
inserted
replaced
| 15:19546f3ef70a | 16:9577cd390ee6 |
|---|---|
| 66 gg_legend = theme(legend.position="none") | 66 gg_legend = theme(legend.position="none") |
| 67 } | 67 } |
| 68 | 68 |
| 69 #density | 69 #density |
| 70 if(options$density == "counts"){ | 70 if(options$density == "counts"){ |
| 71 gg_density = NULL | 71 gg_density = ggplot(input,aes(value ,color=variable)) |
| 72 | |
| 72 } else { | 73 } else { |
| 73 gg_density = , ...density..., | 74 gg_density = ggplot(input,aes(value, ...density...,color=variable)) |
| 75 | |
| 74 } | 76 } |
| 75 | 77 |
| 76 #Choose between automatically scaled x and y axis or user defined | 78 #Choose between automatically scaled x and y axis or user defined |
| 77 if(options$scaling == "Automatic"){ | 79 if(options$scaling == "Automatic"){ |
| 78 gg_scalex = NULL | 80 gg_scalex = NULL |
| 118 gg_colorscale = NULL | 120 gg_colorscale = NULL |
| 119 } else { | 121 } else { |
| 120 gg_colorscale = scale_color_brewer(palette=options$colors, direction=options$colororder) | 122 gg_colorscale = scale_color_brewer(palette=options$colors, direction=options$colororder) |
| 121 } | 123 } |
| 122 | 124 |
| 123 ggplot(input,aes(value gg_density,color=variable)) + | 125 gg_density + |
| 124 geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+ | 126 geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+ |
| 125 gg_scalex+gg_scaley+theme_bw()+xlab(options$xlab)+ylab(options$ylab)+gg_legend+ | 127 gg_scalex+gg_scaley+theme_bw()+xlab(options$xlab)+ylab(options$ylab)+gg_legend+ |
| 126 ggtitle(options$title) | 128 ggtitle(options$title) |
| 127 | 129 |
| 128 ggsave(file=options$output) | 130 ggsave(file=options$output) |
