0

I have a location quotient plot drawn in R and want to draw a horizontal line along the plot where Y = 1. I have the code abline(h=1, col="black") but when the line is drawn, it intersects the Y-axis and crosses out my Y-axis labels.

Does anyone know how to terminate the line at the Y-axis rather than having it intersect?

Many thanks.

David Arenburg
  • 91,361
  • 17
  • 137
  • 196
MyFamily
  • 145
  • 8
  • 2
    That doesn't seem like the usual behavior for abline. Have you changed the `xpd=` par option anywhere? For further help, you'll need to edit your question to include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that we can run to re-create the problem and find out exactly what's wrong. – MrFlick Aug 30 '14 at 17:18
  • maybe use `segments` from grahics? http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/segments.html – B.Mr.W. Aug 30 '14 at 19:57

1 Answers1

1

As mentioned in the comments, it looks like the parameter xpd has been changed, so one option is to change it back to FALSE, see ?par. you can control the clipping region using the clip function to further limit the range that abline and other functions plot within. This may also be affected by you plotting device (different devices can deal with clipping differently).

Greg Snow
  • 48,497
  • 6
  • 83
  • 110
  • Thanks a lot Greg, changing the xpd back to false worked, that was infuriating me last night! Didn't know about the clip function so been having a play around with that. – MyFamily Aug 31 '14 at 16:43