I am plotting a simple histogram of data sampled at, say, 10%. I want counts on the y-axis, but since the data are sampled, I want them to be scaled appropriately. If I were using base graphics, I'd do something like
foo <- rnorm(50)
foo.hist <- hist(foo,plot=F)
foo.hist$counts <- foo.hist$counts * 10
plot(foo.hist)
Is there an easy way to accomplish this with ggplot2?.. There are all sorts of "canned" y-axis transformations (scale_y_log(), etc开发者_如何学运维); is there something more general-purpose?
is this what you are looking for?
df<-data.frame(x=rnorm(50))
ggplot(df,aes(x))+geom_histogram(aes(y=..count..*10))
精彩评论