Re: [R] abline outside of plot region

From: Rolf Turner <rolf.turner_at_xtra.co.nz>
Date: Sat, 30 Apr 2011 16:51:20 +1200

On 30/04/11 01:14, Nick Sabbe wrote:
> Hi R people.
>
>
>
> I ran into this problem: I created a plot with errbars, like this:
>
>> errbar(x=c(1,2,3,4), y=c(2,1,3,3), yminus=c(1.5,0.5,2.5,2.5),
> yplus=c(2.5,1.5,3.5,3.5))
>
> Next, I wanted to accentuate some x value with an abline, like this:
>
>> abline(v=2)
>
>
> In one of my R sessions (which admittedly I have had open for quite a while
> now), the abline draws outside of the plotting region of errbars (till the
> edge of my plotting window at least).
>
> I tested for the cause by opening another session (clean) of the same
> version of R (2.13), and running the same set of commands. In this session,
> I do not have this behavior. Conclusion: I must have changed some graphical
> parameter in my original session, but I don't know which one. Do you?
<SNIP>

I think what has happened is not that *you* changed some graphical parameter,
but rather that the package Hmisc did. In a rather strange way. (I *presume*
that you are using the errbar() function out of Hmisc rather than out of the sfsmisc package --- you didn't say).

For a while I thought that the problem was associated with the *installation*
of Hmisc, becomes it seemed to happen only on the first occasion after I did the install, and on later occasions (quit from R, restart, load Hmisc, try errbar and abline) the problem did not occur.

But then, about the third time I tried the re-install, the problem never happened
at all. But it ***did*** happen, a couple of times. So you're not imagining it,
you'll be pleased to know.

I think that if it *does* happen to you again, you can fix it by setting

     par(xpd=FALSE)

I checked on par()$xpd a couple of times when the problem occurred, and got NA, which is consistent with the observed problem.

The whole thing is weird, but. Gremlins?

     cheers,

         Rolf Turner



R-help_at_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. Received on Sat 30 Apr 2011 - 04:57:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 30 Apr 2011 - 05:00:34 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.

list of date sections of archive