Re: [R] lines at margin?

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Mon 09 Oct 2006 - 15:18:22 GMT

On Mon, 2006-10-09 at 10:56 -0400, Mike Wolfgang wrote:
> Hi list,
>
> I want to add some lines at margin area of one figure. mtext could add text
> to these margins, can I add lines with different lty parameters? Thanks,
>
> mike

You can do it, but it will take some fiddling to get the coordinates right:

 # Do a generic plot
 plot(1:10)

 # Get the current plot region axis ranges  # x1, x2, y1, y2
 par("usr")
 [1] 0.64 10.36 0.64 10.36

 # Draw a vertical line in the right hand margin
 # Set 'xpd = TRUE' so that plotting is not
 # clipped at the plot region boundary

 segments(10.75, 4, 10.75, 6, xpd = TRUE)

See ?par for more information.

HTH, Marc Schwartz



R-help@stat.math.ethz.ch 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. Received on Tue Oct 10 01:24:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 09 Oct 2006 - 16:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.