[R] geom_hline

hadley wickham h.wickham at gmail.com
Tue Dec 25 22:46:58 CET 2007


On Dec 25, 2007 9:32 PM, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:
> Felipe,
>
> You'll need to define the limits yourself with scale_y_continuous.
>
> library(ggplot2)
> p <- ggplot(mtcars, aes(x = wt, y=mpg)) + geom_point()
> p + geom_hline(intercept=0) + scale_y_continuous(limits = c(0, max(mtcars$mpg)))

Or

p + geom_hline(intercept=0) + scale_y_continuous(limits = c(0, NA))

-  the NA means that it will calculate the maximum from the data.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list