Skip to content
Back to formatted view

Raw Message

Message-ID: <OF458B2A73.72A2F8FF-ON802574BB.00533547-802574BB.00539AE0@hsl.gov.uk>
Date: 2008-09-05T15:16:13Z
From: Richard Cotton
Subject: controlling lattice plot ticks with relation="free"
In-Reply-To: <OF6AAC9417.D06FF430-ON802574BB.0039773F-802574BB.003A6ACF@hsl.gov.uk>

> How do you persuade lattice to draw tick marks on both the left and 
right 
> side of the y-axis, when relation="free" in the scales component?
> 
> #Ticks appear on both sides
> histogram(~height|voice.part, data=singer)
> 
> ##Ticks only on left
> histogram(~height|voice.part, data=singer, 
> scales=list(y=list(relation="free")))

I had an off list reply that was very helpful, suggesting the use of 
panel.axis.   For posterity, here's my own answer to my problem, using 
yscale.component. It's not a particularly natural solution, and it 
requires manually increasing the horizontal spacing between plots (with 
the between agrument), but it works.

myyscale.component <- function(...)
{
  ans <- yscale.components.default(...)
  ans$right <- ans$left
  ans$right$labels$labels <- NULL
  ans
} 

histogram(~height|voice.part, data=singer, 
   scales=list(y=list(relation="free")),
   yscale.component=myyscale.component,
   between=list(x=.5))

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}