Christopher David Desjardins
2010-Jun-24 18:16 UTC
[R] Displaying additional values on the Y-axis ggplot2
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
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