Y axis scaling (quantity) in ggplot2 histogram

I draw a simple histogram of data sampled, say, by 10%. I want to rely on the y axis, but since the data is sampled, I want them to be scaled accordingly. If I used basic graphics, I would 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 do this with ggplot2? .. There are all kinds of "canned" transformations of the y axis (scale_y_log (), etc.); is there something more universal?

+4
source share
1 answer

Is this what you are looking for?

 df<-data.frame(x=rnorm(50)) ggplot(df,aes(x))+geom_histogram(aes(y=..count..*10)) 
+5
source

All Articles