ggplot2 binwidth with factor(variable)?
I have simple histogram, but can't adjust the binw开发者_JAVA技巧idth:
qplot(factor(size_class),data=mydf,geom="histogram",binwidth = 0.01)
size_class is a categorical variable (char) that groups mydf into groups according to another size variable. All I want to get is a graph like:
plot(table(mydf$size_class)
using ggplot2. The code above does work but binwidth is ignored somehow. I feel it has something to do with my group variable, since examples with numeric variables worked. How can I get it done with this kind of variable?
thx in advance for any help…
You can't set the binwidth for a categorical variable - it doesn't mean anything because there isn't an underlying continuous scale.
精彩评论