20

Thank you for reading. I find that I am unable to draw lines/points or add text outside of the plot area. If I draw a line from inside the plot (within the axis) area to the area of the xlab main title areas only the part within the plot shows. In a multiple plot graph (mfrow) the line/point will only be drawn inside the last active plot.

plot(0);
l=locator(2,type='n');
lines(l, type='l'); 

Any solution to this problem? Thanks!

Adam SO
  • 9,821
  • 8
  • 28
  • 27

1 Answers1

41

The xpd parameter controls where you can draw. Check the current value with par()$xpd and then try setting par(xpd=NA).

From the par help:

 ‘xpd’ A logical value or ‘NA’.  If ‘FALSE’, all plotting is
      clipped to the plot region, if ‘TRUE’, all plotting is
      clipped to the figure region, and if ‘NA’, all plotting is
      clipped to the device region. See also ‘clip’.
user1076
  • 721
  • 7
  • 5
  • Thanks! When I looked through par in an attempt to figure this out myself I didn't realize the relevance of xpd. – Adam SO Aug 27 '10 at 15:37
  • 3
    Yeah, I find the par man page pretty impenetrable. I'm not sure how much of my life I've spent staring at it but it's a significant proportion. I've got this over my desk: http://cran.r-project.org/doc/contrib/Short-refcard.pdf It doesn't get as deep as xpd but it usually gives me a starting point. – user1076 Aug 27 '10 at 16:03
  • 3
    Check also the mtext() function for putting text in the margins. Also you can do quite everything you want with the grid interface, but it is rather difficult to grasp at first; a good starting point is Paul Murrell's website: http://j.mp/a9fplf. – chl Aug 27 '10 at 16:15