[R] in axis() suppressing axis line but keeping tick marks

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jun 17 00:40:42 CEST 2008


On 16/06/2008 4:49 PM, Peter Dalgaard wrote:
> Andrew Yee wrote:
>> I've been trying to figure out a parameter that will let you separately
>> adjust the parameters for the axis line from the tick mark.
>>
>> In the following example, I would like to suppress the axis line, but keep
>> the tick marks.
>>   
> The source code is the ultimate reference. We have in do_axis in 
> src/main/plot.c:
> 
>     if (doticks) {
>         gpptr(dd)->col = col;/*was fg */
>         GLine(axis_low, axis_base, axis_high, axis_base, NFC, dd);
>         for (i = 0; i < n; i++) {
>             x = REAL(at)[i];
>             if (low <= x && x <= high) {
>                 x = GConvertX(x, USER, NFC, dd);
>                 GLine(x, axis_base, x, axis_tick, NFC, dd);
>             }
>         }
>     }
> 
> and, as you see, there is no way the line parameters can change between 
> the GLine calls, no hope of finding a magical par() setting. So I'm 
> afraid you have to bite the bullet, do the relevant coordinate 
> calculations, and use segments() do draw the ticks. (Or try convincing 
> Paul Murrell to change the design, but that takes longer...).

I'd also mention pretty(), to calculate tick mark locations.

Duncan Murdoch

>



More information about the R-help mailing list