[R] Displaying additional values on the Y-axis ggplot2

Brian Diggs diggsb at ohsu.edu
Thu Jun 24 23:37:23 CEST 2010


On 6/24/2010 11:16 AM, Christopher David Desjardins wrote:
> Hi,
> I am running the following code:
>
> mfg0 <- ggplot(aes(x=Grade,y=Math,colour=RiskStatic45678),data=math.f)
> mfg1 <- mfg0 + geom_smooth(method="lm", formula=y ~ ns(x,2),size=1) +
> geom_smooth(aes(y=nalt.math,color="NALT"),size=1,data=nalt) +
> scale_colour_brewer("Risk Status", pal="Set1") + coord_cartesian(ylim =
> c(175, 245))
> mfg1
>
> And when I specify that, the only value that shows up on the Y-axis is a
> '200'. How can I manually specify that I want 180, 200, 220, and 240 to
> show up? Also please cc me on the email as I am a digest subscriber.
>
> Chris
>

Untested (since example is not reproducible), but adding

scale_y_continuous(breaks=c(180,200,220,240))

should work.

--
Brian Diggs
Senior Research Associate, Department of Surgery, Oregon Health & 
Science University



More information about the R-help mailing list