lattice: drawing strips for single-panel plots

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

lattice: drawing strips for single-panel plots

John G. Bullock-2

The strip argument to panel.xyplot seems to be ignored for single-panel
plots.  Here is an example:

   data(Chem97, package = "mlmRev")
   myStrip <- function(...) { ltext(.5, .5, 'strip text') }
   densityplot(~ gcsescore, data = Chem97, strip=myStrip)

The figure is printed with no strip.  The strip.default documentation
suggests that Deepayan intended this behavior.  Still, it would help to
be able to use the strip argument for single-panel plots.  Is there a
simple way to do this?

Thank you,
John

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: lattice: drawing strips for single-panel plots

Dieter Menne
John G. Bullock-2 wrote
The strip argument to panel.xyplot seems to be ignored for single-panel
plots.  Here is an example:

   data(Chem97, package = "mlmRev")
   myStrip <- function(...) { ltext(.5, .5, 'strip text') }
   densityplot(~ gcsescore, data = Chem97, strip=myStrip)

The figure is printed with no strip.
The workaround is to give it a one-level factor:

library(lattice)
data(Chem97, package = "mlmRev")
Chem97$what = as.factor("strip text")
densityplot(~ gcsescore|what, data = Chem97)
Reply | Threaded
Open this post in threaded view
|

Re: lattice: drawing strips for single-panel plots

John G. Bullock-2
In reply to this post by John G. Bullock-2
>
>> The strip argument to panel.xyplot seems to be ignored for
>> single-panel plots.

> The workaround is to give it a one-level factor:
>
> library(lattice)
> data(Chem97, package = "mlmRev")
> Chem97$what = as.factor("strip text")
> densityplot(~ gcsescore|what, data = Chem97)

Thank you.  That works.

John

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.