On Tue, 2011-05-03 at 10:36 -0600, Ryan Utz wrote: > Hi all, > > I'm attempting to make a quite-specific plot where the axes cross at the > origin and with gridlines for guidance. I've been using ablines to create > the reference lines because I want a lot of control as to where they are > placed on the axis. This command works very well for such control. > However... > > These ablines don't seem to work when I specify the origin as 0,0. They go > beyond the x-axis at both ends, rendering a quite ugly graph (and they push > back the y-axis title some). > > Behold: > > ### > x<-c(0,1,2,3,4,5) > y<-c(0,2,4,6,8,10) > > plot(x,y, axes=FALSE) > axis(1,at=c(0,1,2,2.5,3,4,5),pos=0) > axis(2,at=c(0,2,4,6,8,10),pos=0) > abline(h=c(1,2,3,4,5)) > ### > > Is there any way for me to specify that these ablines should not go beyond > the y-axis extent? I just want a pretty graph! > > Thanks! > Ryan >
Maybe you could use lines()? plot(1:2) lines(c(1,2),c(1.5,1.5)) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.