Quantcast

Where are the ticks on grid.xaxis?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Where are the ticks on grid.xaxis?

David A. Johnston
Hi R list,

I like the default ticks that are set up using grid.xaxis() or grid.yaxis() with no arguments.  Finding good values for the 'at' argument is usually not a trivial task; the default behavior of these functions seems to work well.  The problem with this strategy is that I cannot figure out how to "recover" the positions of these ticks when you do NOT specify the 'at' argument.  

For example:

grid.newpage()
pushViewport(plotViewport(c(5, 4, 2, 2), name = "myvp"))
# This draws a default xaxis
a = grid.xaxis(name = "myX")
# What are the tick marks?
grid.get("myX")$at  # NULL

# But if I specify an 'at' argument...
grid.edit("myX", at = seq(0, 1, length = 10))
# ...I can get at the position of the ticks
grid.get("myX")$at

Is it possible to find the tick positions created by grid.xaxis() or grid.yaxis() if no 'at' parameter is specified?

Thanks,

-David Johnston
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Where are the ticks on grid.xaxis?

Paul Murrell
Hi

Are you looking for the axTicks() function (or possibly the pretty()
function) ?

Paul

On 19/08/2011 3:51 a.m., David A. Johnston wrote:

> Hi R list,
>
> I like the default ticks that are set up using grid.xaxis() or grid.yaxis()
> with no arguments.  Finding good values for the 'at' argument is usually not
> a trivial task; the default behavior of these functions seems to work well.
> The problem with this strategy is that I cannot figure out how to "recover"
> the positions of these ticks when you do NOT specify the 'at' argument.
>
> For example:
>
> grid.newpage()
> pushViewport(plotViewport(c(5, 4, 2, 2), name = "myvp"))
> # This draws a default xaxis
> a = grid.xaxis(name = "myX")
> # What are the tick marks?
> grid.get("myX")$at  # NULL
>
> # But if I specify an 'at' argument...
> grid.edit("myX", at = seq(0, 1, length = 10))
> # ...I can get at the position of the ticks
> grid.get("myX")$at
>
> Is it possible to find the tick positions created by grid.xaxis() or
> grid.yaxis() if no 'at' parameter is specified?
>
> Thanks,
>
> -David Johnston
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Where-are-the-ticks-on-grid-xaxis-tp3752945p3752945.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[hidden email]
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
[hidden email] 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.
Loading...