[R] abline outside of plot region

Peter Ehlers ehlers at ucalgary.ca
Fri Apr 29 15:56:14 CEST 2011


On 2011-04-29 06: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?
>
>
>
> As an addendum: I also want to add a few specific axis ticks besides the
> standard ones in my graph. I used axis for this, and it works. I set
> col.ticks to match the color of my abline (in the nonsimplified code), and
> this works too, but unfortunately, the label below the tick is not in this
> color, and a parameter for this is not present in axis.
>
>
>
> Suggestions for either? Note: I'm on windows 7 with R 2.13.

   plot(1:4, xaxt='n')
   axis(1, at=2:3, lab=c('a', 'b'),
        col.ticks=3, col.axis=2, lwd=0, lwd.ticks=1)
   par(xpd = TRUE)
   abline(v = 4)

Peter Ehlers

>
>
>
> Nick Sabbe
>
> --
>
> ping: nick.sabbe at ugent.be
>
> link:<http://biomath.ugent.be/>  http://biomath.ugent.be
>
> wink: A1.056, Coupure Links 653, 9000 Gent
>
> ring: 09/264.59.36
>
>
>
> -- Do Not Disapprove
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list