tags:

views:

29

answers:

1

Dear all,

I have simple histogram, but can't adjust the binwidth:

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…

+1  A: 

You can't set the binwidth for a categorical variable - it doesn't mean anything because there isn't an underlying continuous scale.

hadley