Check your par() settings, specifically "xpd".  For more control see ?clip.  If 
that does not do enough for you then use lines or segments for complete control.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ryan Utz
> Sent: Tuesday, May 03, 2011 10:36 AM
> To: r-help@r-project.org
> Subject: [R] Controlling the extent of ablines on plot
> 
> 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
> 
> --
> 
> Ryan Utz, Ph.D.
> Aquatic Ecologist/STREON Scientist
> National Ecological Observatory Network
> 
> Home/Cell: (724) 272-7769
> Work: (720) 746-4844 ext. 2488
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

______________________________________________
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.

Reply via email to