[R] abline outside of plot region

2011-04-29 Thread Nick Sabbe
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.

 

Nick Sabbe

--

ping: nick.sa...@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@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.


Re: [R] abline outside of plot region

2011-04-29 Thread Peter Ehlers

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.sa...@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@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.


__
R-help@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.


Re: [R] abline outside of plot region

2011-04-29 Thread Rolf Turner

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@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.