[R] Varying x-axis labels in lattice

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Aug 12 13:58:59 CEST 2009

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


Deepayan Sarkar wrote:
> 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.
> -Deepayan

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

More information about the R-help mailing list