[R] Changing axis labels depending on panel in lattice

David Winsemius dwinsemius at comcast.net
Fri Mar 16 18:36:27 CET 2012


On Mar 16, 2012, at 1:34 PM, Saptarshi Guha wrote:

> Hello,
>
> I am lattice scatterplot that has 2 panels (could be a few more). Both
> panels have a y-axis label that is different on the
> left and right sides. However the right hand side axis labelling  
> depends on
> which panel i'm in .
>
> (I am plotting two curves in one panel, the left y-axis has the  
> scale for
> the red line and the right y-axis has the scale for the blue line
> I need to convert the y-lims for blue to the scales of the red line.  
> Since
> the scales depend on the panel, all i need to know
> is which panel i'm in.)
>
> Im using  ,axis=axis.PCT in xyplot and right now
>
>
>
> axis.PCT<-
>    function(side, ...)
> {
>    ylim <- current.panel.limits()$ylim
>    switch(side,
>           left = {
>               prettyF <- pretty(ylim)
>               panel.axis(side = side, outside =  
> TRUE,text.cex=0.5,rot=0,
>                          at = prettyF, labels = prettyF)
>           },
>           axis.default(side = side, ...))
>
> Is there anything i can do get the information regarding the panel  
> i'm in?

?panel.number
>


-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list