I'm trying to plot a histogram of values around 95%. For easier reading,
I'd like to start histogram at 60% instead of zero. Unfortunately, I
couldn't find a way to do it !
Here is a reproducible example:
y<-runif(16,0.6,1)
x<-c(rep("A",4),rep("B",4),rep("C",4),rep("D",4))
type<-rep(c("1","2","3","4"),4)
data<-data.frame(x=x,y=y,type=type)
Here is a plot starting from zero :
ggplot(data,aes(x=x,y=y))+geom_bar(aes(fill=type),colour='black',position="dodge",stat="identity")+scale_y_continuous(formatter="percent")
However, when "limiting" y values, the plot just disappears:
ggplot(data,aes(x=x,y=y))+geom_bar(aes(fill=type),colour='black',position="dodge",stat="identity")+scale_y_continuous(limits=c(0.6,1),formatter="percent")
I also tried to use the (not documented) "origin" argument of stat_bin()
function, but it is exactly identical to the first plot (seems like
"origin" does nothing):
ggplot(data,aes(x=x,y=y))+stat_bin(aes(fill=type),colour='black',position="dodge",origin=0.6,geom="histogram")+scale_y_continuous(formatter="percent")
Does anyone has an idea how to start a histogram from an arbitrary value
instead of 0 ?
Thanks in advance for any help !
Cheers,
Pierre.
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2
That might be a bug...
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
Hadley