Saptarshi Guha
2012-Mar-16 17:34 UTC
[R] Changing axis labels depending on panel in lattice
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]]
David Winsemius
2012-Mar-16 17:36 UTC
[R] Changing axis labels depending on panel in lattice
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
Thanks! Exactly what i need Saptarshi -- View this message in context: http://r.789695.n4.nabble.com/Changing-axis-labels-depending-on-panel-in-lattice-tp4478854p4479368.html Sent from the R help mailing list archive at Nabble.com.