[R] Varying x-axis labels in lattice

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Aug 12 01:57:09 CEST 2009

On Tue, Aug 11, 2009 at 6:30 AM, Frank E Harrell
Jr<f.harrell at vanderbilt.edu> wrote:
> 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?

'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.


More information about the R-help mailing list