Richard.Cotton at hsl.gov.uk
2008-Sep-05 10:41 UTC
[R] controlling lattice plot ticks with relation="free"
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"))) Providing tck as a vector of length 2 doesn't seem to work, neither does setting alternating=3 (since the argument is ignored, and I don't really want the labels on both sides - just the ticks). I'm sure I'm missing something obvious. Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}
Richard.Cotton at hsl.gov.uk
2008-Sep-05 15:16 UTC
[R] controlling lattice plot ticks with relation="free"
> How do you persuade lattice to draw tick marks on both the left andright> 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}}