r - In ggplot, how can I set ylim and also lower the histogram to the x-axis? -


i have number of histograms created in ggplot2. in of them, highest value touches upper part of frame. have little space between tallest bin , frame. know can change upper limit manually ylim finding conflict scale_y_continuous() command. here's analogous problem using iris data.

simple plot

ggplot(iris,aes(sepal.length)) + geom_histogram() 

drop histogram down x-axis

ggplot(iris,aes(sepal.length)) + geom_histogram() +  scale_y_continuous(expand = c(0.0,0)) 

change upper limit of y-axis

ggplot(iris,aes(sepal.length)) + geom_histogram() +  scale_y_continuous(expand = c(0.0,0)) + ylim(0,15) 

now, histogram no longer sitting on x-axis. appears scale_y_continuous() command switched off ylim(). there way around conflict? there way set upper limit of ylim arithmetic expression adding 5 maximum bin height?


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -