KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am confused about the meaning of the following variants of geom_density in ggplot: Can someone please explain the difference between these four calls: geom_density(aes_string(x=myvar)) geom_density(aes_string(x=myvar, y=..density..)) geom_density(aes_string(x=myvar, y=..scaled..)) geom_density(aes_string(x=myvar, y=..count../sum(..count..))) My understanding is that: geom_density alone will produce a density whose area under the curve sums to 1 geom_density with ..density.. basically does the same... ? the ..count../sum(..count..) will normalize the peak heights to be more like a normalized histogram, ensuring that all the heights sum to 1 the ..count.. by itself without the denominator will just multiply each bin by # of items in it the ..scaled.. parameter will make it so the maximum value of the density is 1. I find ..scaled.. very counterintuitive and have never seen it used if my interpretation of it is correct so I'd like to ignore that. I am mainly looking for a clarification of the differences between geom_density and a kind of normalized density plot, which I am assuming requires the ...count../... argument. thanks. (Related: Error with ggplot2 mapping variable to y and using stat="bin" )
Tags (comma-separated)
Save Edits
Cancel