Specialist panel functions for use with lattice and loa plots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
panel.loaLevelPlot(x = NULL, y = NULL, z = NULL, ..., loa.settings = FALSE) panel.surfaceSmooth(x = NULL, y = NULL, z = NULL, breaks = 200, x.breaks = breaks, y.breaks = breaks, smooth.fun = NULL, too.far=0, ..., plot = TRUE, process = TRUE, loa.settings = FALSE) panel.kernelDensity(x, y, z = NULL, ..., n = 20, kernel.fun = NULL, panel.range = TRUE, process = TRUE, plot = TRUE, loa.settings = FALSE) panel.binPlot(x = NULL, y = NULL, z = NULL, breaks=20, x.breaks = breaks, y.breaks = breaks, x1=NULL, x2=NULL, y1=NULL, y2=NULL, statistic = mean, pad.grid = FALSE, ..., plot = TRUE, process = TRUE, loa.settings = FALSE)
Additional arguments, typically passed on. See below.
panel.loaLevelPlot is intended for plot data structured
for use with the
(x,y,z) or a
loaPlot(..., panel = panel.loaLevelPlot)
levelplot(...) #in lattice
panel... functions can be used with the
xyplot(..., panel = panel.kernelDensity)
xyplot(..., n = 50, panel = panel.kernelDensity)
xyplot(..., panel = function(...) panel.kernelDensity(..., n = 50))
However, they are intended for use with
loa plots that incorporate
panelPal. This combination provides a mechanism for the
routine preprocessing of panel data, the association of specialist keys,
and the routine alignment of panel and legend settings in cases where
values are reworked within the panel function call:
loaPlot(..., panel = panel.kernelDensity)
panel.surfaceSmooth and other similar
generate smoothed surfaces using supplied
(x,y,z) data and pass
panel.loaLevelPlot to plot.
loess to generate a surface. Alternative smooths
can be set using the
smooth.fun argument, and the surface
range can to controlled using the
panel.kernelDensity generates kernel density estimations
based on the supplied
y data ranges. Because it is
density plot, it counts the number of
z values. So,
are ignored. It is intended to be used in the form:
loaPlot(~x*y, ..., panel = panel.kernelDensity)
So, if any
z information is supplied, users are warned that it has
been ignored, e.g:
loaPlot(z~x*y, ..., panel = panel.kernelDensity)
panel.binPlot bins supplied
z data according to
y values and associated break points (set by
and then calculates the required statistic for each of these. By default,
mean, but alternative functions can be set using the
statistic argument. It is intended to be used in form:
loaPlot(z~x*y, ..., panel = panel.binPlot)
z values are supplied, as in:
loaPlot(~x*y, ..., panel = panel.binPlot)
(again with a warning) and gives a count of the number of elements in
As with other
panel... functions in this package, output are suitable
for use as the
panel argument in
loa (and sometimes
lattice) plot calls.
panel... functions treat
etc, as discrete arguments. Typically,
col links to lines (contour
lines for surfaces, bin borders for binned data) and
links any generates surface region.
panel.surfaceSmooth passes additional arguments on to the
smooth.fun to estimate surface smooths and the
panel.levelplot to generate the associated plot.
kernel.fun is supplied in the
panel call, the
loess is used to estimate surface smooth.
too.far argument is based on same in
function in the
panel.kernelDensity passes additional arguments on to the
kernel.fun to estimate kerenel density and the
panel.contourplot to generate the associated plot.
kernel.fun is supplied in the
panel call, the
kde2d is used to estimate kernel density.
panel.binPlot passes limited arguments on to
panel.binPlot are currently under
These function makes extensive use of code developed by others.
lattice: Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5
panel.kernelDensity) MASS package:
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics
with S. Fourth edition. Springer.
panel.surfaceSmooth) mgcv package and too.far argument:
Wood, S.N. (2004) Stable and efficient multiple smoothing parameter
estimation for generalized additive models.Journal of the American
Statistical Association. 99:673-686.
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
## Example 1 ## for data already set up for levelplot loaPlot(volcano, panel=panel.loaLevelPlot) ## Example 2 ## Surface smooth loaPlot(copper~longitude*latitude, data= lat.lon.meuse, panel=panel.surfaceSmooth, grid=TRUE, too.far=0.1, col.regions=3:2) ## Example 3 ## (not run) ## 3a. Specialist kernel density panel example #a <- rnorm(1000) #b <- rnorm(1000) #c <- rnorm(1000) #compare: #xyplot(a~b, panel = panel.kernelDensity, at = 0:5*5) #loaPlot(~a*b, panel = panel.kernelDensity) # Note 1: # at sets col.regions for the color surface, but, as this is calculated # in-panel, this is not known at time of call. So, you need to set when # using specialist panels with standard lattice plots. # (Same is true for any panel where plot attributes that are set in-panel # and is needed to be known in all panels and keys for consistent output.) # loa panels include separate process and plot steps that panelPal can # use to track these. # Note 2: # By default, the panel ignores z data. # # compare: # loaPlot(c~a*b, panel = panel.kernelDensity) #where z term (c) ignored # loaPlot(c~a*b, panel = panel.kernelDensity, n=100) #finer surface resolution #but z term STILL ignored ## 3b. Specialist bin plot panel example # By default, the panel bins supplied z case as mean # modify by supplying alternative as statistic #loaPlot(c~a*b, panel = panel.binPlot) #loaPlot(c~a*b, panel = panel.binPlot, statistic=max) # Note: # If z is not supplied, statistic defaults to length to give a count # loaPlot(~a*b, panel = panel.binPlot) #where z term not supplied #etc.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.