Changing axis labels depending on panel in lattice

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing axis labels depending on panel in lattice

Saptarshi
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?

Regards
Saptarshi

        [[alternative HTML version deleted]]

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: Changing axis labels depending on panel in lattice

David Winsemius

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

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

Re: Changing axis labels depending on panel in lattice

Saptarshi
Thanks! Exactly what i need

Saptarshi