Trochelman, Jacob (GE Aviation, US)
2014-Mar-12 13:33 UTC
[R] ggplot2 Histogram with density curve
http://grokbase.com/p/r/r-help/1169gqdxcs/r-ggplot2-histogram-with-density-curve # If you want it on the count scale, that is trickier and requires # knowing (setting) the binwidth and keeping that value in sync in # two places. # In this example, the binwidth is 0.2 (set in geom_histogram and also # used in the aes of geom_density). ggplot(DF, aes(x=t)) + geom_histogram(fill="blue", colour="black", binwidth=0.2) + geom_density(aes(y=0.2*..count..), colour="black", adjust=4) + opts(title="Normal Random Sample") How is the above accomplished with a variable binwidth? I.e. if I set my binwidth to a variable 'H' and use 'H' in place of '0.2' above why do I receive an error saying "Error in eval(expr, envir, enclos) : object 'H' not found" Jacob Trochelman OnPoint Contract Engineering (OCE) Services Engineering GE Aviation 513.243.6449 P Please consider the environment before printing this email. [[alternative HTML version deleted]]