May I ask for further illumination of my dumbness?
I had been merrily plotting ..density.. and using xlim() to constrain the
x-axis like this and everything was working fine:
df<-data.frame(names=c("Bob","Mary","Joe","Bob","Bob"))
ggplot(df,aes(names,..density..,group=1))+geom_histogram()+xlim("Bob","Mary")
So I was a little surprised when this didn't work the same way:
ggplot(df,aes(names))+geom_histogram()+xlim("Bob","Mary")
Actually, looking at the above sparks an idea. I thought there was a
difference between plotting ..count.. and ..density.., but in fact it's the
group=1 that makes the first example work. Both of these behave as one
would hope:
ggplot(df,aes(names,group=1))+geom_histogram()+xlim("Bob","Mary")
ggplot(df,aes(names,..count..,group=1))+geom_histogram()+xlim("Bob","Mary")
...though I admit that I'm not exactly sure why. Can anyone explain?
Thanks,
-J
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.