[R] Axes Labels on the Right side of lattice panel
Deepayan Sarkar
deepayan.sarkar at gmail.com
Fri Sep 19 07:51:46 CEST 2008
On 9/18/08, Saptarshi Guha <saptarshi.guha at gmail.com> wrote:
> Hello,
> My plot has two curves on different scales. To create the scale on
> the extreme right hand side of a panel
> I followed the example in panel.axis (in this example, the tick marks
> are at the same location and labels are the same too)
>
> axis=function(side, ... )
> {
> ylim <- current.panel.limits()$ylim
> if(side=="left"){
> prettyC=c(pretty(ylim))
> panel.axis(side = side,
> at=prettyC,tck=1,text.cex=0.7,outside = TRUE)
> }
> else if(side=="right"){
> prettyC=c(pretty(ylim))
> panel.axis(side = side, at=prettyC, tck=1,outside =
> TRUE,text.col='grey32',text.cex=0.7)
> }
> else {
> axis.default(side = side, ...)
> }
> }
>
> However, all I see are the tick marks and the text gets clipped. I'm
> aware that this might happen (as pointed out in the help page)
> but how can I get around it? Should I specify a width to the device?
You mean the example on ?axis.default? (panel.axis doesn't have any
examples.) Look at the example after that, which uses
yscale.components.default. This one should take care of spacing (if
you have a recent enough version of lattice).
-Deepayan
More information about the R-help
mailing list