[R] how to control ticks in plots with yasp or xasp

Denis Chabot chabotd at globetrotter.net
Sat Oct 8 19:36:48 CEST 2005


Hi Brian,
Le 05-10-08 à 13:21, Prof Brian Ripley a écrit :

> On Sat, 8 Oct 2005, Denis Chabot wrote:
>
>
>> Hi, sorry about the bad syntax, though the right syntax would not  
>> have worked either, according to your tests (Mark, Brian, Peter).
>>
>
> It DOES work according to my tests!  (Do give us the credit for  
> testing our advice:  we would appreciate your showing equal care.)

I am very sorry, I did not express myself properly. I do appreciate  
your help, and I did take the time to test your solution. What I  
meant was that even if I had use the proper syntax, i.e. yaxp=c 
(10,100,10) instead of y=(10,100,10) [actually in my program I had  
used it but I was careless when I composed the message], it would not  
have worked because you demonstrated that it has to be used within a  
"par" statement, which I had not done. Therefore my attempt was  
doomed. I did not mean there was no way to make yaxp work, so I  
apologize if you think I take your advice lightly, and I cannot state  
strongly enough that it is not the case at all.
>
>
>> Anyway it is too finicky, I will draw them myself. For instance,
>>
>> plot(1:100, xaxt="n")
>> par(xaxp=c(0, 100, 10))  # the value is reset at each plot
>> axis(1)
>>
>> Placed tick marks at intervals at 0, 10, ..., 100, as expected,  
>> but did not place a label under 100...
>>
>
> Does for me (2.2.0, Windows and X11 on Linux).  Might the text be  
> clipped on your unnamed device, so you need to set xpd?  (If so, it  
> will be clipped however you try to do this, and is an unrelated  
> local problem.)
>
>
This is strange.

I work on Mac OS X, so the default device is quartz. Label 100 is  
shown without clipping if plot without changing xaxp. But just in  
case I made more space at the right of the graph with

par(mai=c(0.7, 0.7, 0.5, 0.5))
plot(1:100, xaxt="n")
par(xaxp=c(0, 100, 10))  # the value is reset at each plot
axis(1)

and the 100 does not appear. If I run this again:
plot(1:100, xaxt="n")
axis(1)

I'm back with R's default axis and the 100 is present. Anyone on a  
Mac wants to try?

Denis


> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>




More information about the R-help mailing list