Skip to content

Varying x-axis labels in lattice

4 messages · Duncan Mackay, Deepayan Sarkar, Frank E Harrell Jr

#
Dear Group:

I want to use lattice with a formula such as y ~ x | v to plot a data 
frame in which v varies to indicate which "x" is really being plotted. 
I know how to make the x-axis scales vary with the panel but is it 
possible to let the x-axis label vary, i.e., to let the user specify a 
vector of x-axis labels?

Thanks
Frank
#
On Tue, Aug 11, 2009 at 6:30 AM, Frank E Harrell
Jr<f.harrell at vanderbilt.edu> wrote:
'xlab' can be a vector, but this is mostly useful for column-specific
(not panel-specific) labels; e.g.,

 densityplot(~Sepal.Length + Sepal.Width, data = iris,
              groups = Species, strip = FALSE, layout = c(2, 1),
              xlab = c("Sepal.Length", "Sepal.Width"))

Does that help? Otherwise using strips as Duncan suggested is the only
simple solution.

-Deepayan
#
Thanks very much Deepayan and Duncan.  Both of your suggestions are very 
helpful and should do what I need.

Frank
Deepayan Sarkar wrote: