lattice plot management using the
1 2 3 4 5 6 7 8 9
A panel function, e.g.
Additional arguments, typically passed on.
Any additional arguments that
Fine control of the standard
panelPal provides a range of generic plot management features.
Firstly, it allows plot as well as panel defaults to be managed by the
panel... function. This allows the panel developer to control
plot-level components of the plot output, e.g. which key to use with the
plot and what default settings to apply to it. See example 1 below.
Secondly, it uses a generalised extension of the subscripting methods described by Deepayan Sarkar in Chapter 5 of Lattice (see sections on scatterplots and extensions) to automatically handle plot argument subscripting, demonstrated in example 2 below.
Thirdly, it applies an extension of the method used by the hexbin lattice panel to pass hex cell counts (calculated in panels) to the plot key and standardise the assignment of associated parameters within all panels to provide more general panel-to-panel and panel-to-scale. The method is briefly discussed in Chapter 14 of Sarkar.
This method has also been extended by isolating processing and plot components
panel... function operation allowing results of any calculations
made in-panel to be retained rather than lost when plot is generated.
zcase... arguments can used to manage plot
group and zcase based plot outputs.
panelPal are implemented if specially structured (or loa-friendly)
panel... functions are supplied. These are illustrated in the final
loaHandler is a workhorse that assesses information in 'loa' friendly
panel... functions. As well as checking this,
checks the supplied panel for any default plot settings. This allows users to
manage the appearance of a plot from the panel or automatically associated
panelPal.old are intended to be used with
trellis plot outputs.
panelPal should be employed retrospectively. So, for example:
p1 <- xyplot(...)
The previous version, currently retained as
panelPal.old, was employed
developed as a
panel... function wrapper and intended to be employed
within the plot call. So, for example:
xyplot(..., panel = function(...) panelPal(..., panel=panel))
Because it is run within the plot call, and therefore within each panel called, it does not provide features that require panel-to-plot, panel-to-key or panel-to-panel communication.
loaHandler returns either a logical (
FALSE if not loa 'friendly';
TRUE if loa 'friendly') or a list of default arguments to be used when
by.zcase arguments of
group.fun argument of
panelPal.old are all currently
under review. Please do not use these.
These function makes extensive use of code developed by others.
Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5
Dan Carr, ported by Nicholas Lewin-Koh and Martin Maechler (2013). hexbin: Hexagonal Binning Routines. R package version 1.26.2. http://CRAN.R-project.org/package=hexbin
panelPal both apply an extension
of the subscripting methods described by Deepayan Sarkar in Chapter
5 of Lattice (see sections on scatterplots and extensions) to
automatically handle plot argument subscripting.
panelPal applies an extension of the method used by
hex bin lattice panel to comunicate hex cell counts (calculated
in panels) panel-to-panel and panel-to-scale. The method is
briefly discussed in Chapter 14 of Sarkar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
## the combination of panelPal and specially ## structured panel... functions provides ## several additional plot features: ## example 1 ## plot management from the panel... functions. # loaHandler can used to see if a panel is loa-friendly loaHandler(panel.xyplot) #FALSE loaHandler(panel.loaPlot) #panel defaults # note that these include a list called # default.settings. These are settings that are # automatically added to the plot call. # Here this assigns a specialist key to that # panel. However, the same mechanism can also # be used to turn off plot elements like the # standard lattice axes, when using in panel # alternatives # first some silly data a <- rnorm(1000) b <- rnorm(1000) # now compare: # default plot # note bubble plot style key loaPlot(a~a*b) # bin plot # with classic color key loaPlot(a~a*b, panel = panel.binPlot) ## example 2 ## automatic subscripting with loa # Other arguments are not automatically # aligned with the main plots. # For example, consider the data: a <- 1:10 ref <- rep(1:2, each=5) # and associated lattice xyplot output: xyplot(a~a|ref, col=ref, pch=19) # Here, the 'col' argument does not # automatically track plot conditioning. # With lattice plots you need to assign # arguments you want to track in this # manner using subscripts, as discussed # in Lattice Chapter 5. # Now compare a similar loaPlot: loaPlot(~a*a|ref, col=ref, pch=19) # Here, panelPal automatically handles # such subscripting. It extends this # assumption to all supplied arguments. # For example, try # loaPlot(~a*a|ref, col=ref, pch=ref) # loaPlot(~a*a|ref, col=ref, pch=1:10) # etc