[R] [lattice] how to label panels with variable value (not name)?

Bert Gunter gunter.berton at gene.com
Sun Nov 18 16:48:46 CET 2012


AFAICS, you will have to pre-compute the values and create a factor
with levels these values as character strings. Then use this factor as
the conditioning variable

?sprintf
?formatC
?round

and the like may be useful to format the numerical values suitably for
your labels.

Cheers,
Bert

On Sun, Nov 18, 2012 at 6:43 AM, Tom Roche <Tom_Roche at pobox.com> wrote:
>
> As described @
>
> https://stat.ethz.ch/pipermail/r-help/2012-November/329442.html
>
> I now know how to prepare my netCDF data specifying gas concentrations
> over a 3D space (dimensions longitude, latitude, and (vertical) level),
> so as to call lattice::levelplot() like
>
> levelplot(conc ~ lon * lat | lev, data=data.frame)
>
> which labels each panel in the lattice of plots with the name "lev" plus
> a graphical indicator of the level value. Alternatively, I can label
> each panel with an index (i.e., "1", "2", ...) by calling
>
> levelplot(conc ~ lon * lat | factor(lev), data=data.frame)
>
> However I will need to before-and-after compare this to the results of a
> reboxing, or 3D regridding, of this data, so I would prefer instead to
> label each panel in the lattice with the _value_ of the level (an
> atmospheric pressure), rather than the name or index of the level.
> How to do that?
>
> TIA, Tom Roche <Tom_Roche at pobox.com>
>
> ______________________________________________
> R-help at r-project.org 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list