File: panel.levelplot.Rd

package info (click to toggle)
lattice 0.20-41-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,988 kB
  • sloc: ansic: 357; makefile: 2
file content (163 lines) | stat: -rw-r--r-- 5,958 bytes parent folder | download | duplicates (6)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
\name{F_1_panel.levelplot}
\alias{panel.levelplot}
\alias{panel.contourplot}
\alias{panel.levelplot.raster}
\title{ Panel Functions for levelplot and contourplot }
\description{
  These are the default panel functions for \code{\link{levelplot}} and
  \code{contourplot}.  Also documented is an alternative raster-based
  panel function for use with \code{levelplot}.
}
\usage{
panel.levelplot(x, y, z, 
                subscripts,
                at = pretty(z),
                shrink,
                labels,
                label.style = c("mixed", "flat", "align"),
                contour = FALSE,
                region = TRUE,
                col = add.line$col,
                lty = add.line$lty,
                lwd = add.line$lwd,
                border = "transparent",
                border.lty = 1,
                border.lwd = 0.1,
                \dots,
                col.regions = regions$col,
                alpha.regions = regions$alpha,
                identifier = "levelplot")
panel.contourplot(\dots)

panel.levelplot.raster(x, y, z, 
                       subscripts,
                       at = pretty(z),
                       ...,
                       col.regions = regions$col,
                       alpha.regions = regions$alpha,
                       interpolate = FALSE,
                       identifier = "levelplot")



}
\arguments{
  \item{x, y, z}{ Variables defining the plot. }
  \item{subscripts}{
    Integer vector indicating what subset of \code{x}, \code{y} and
    \code{z} to draw.
  }
  \item{at}{
    Numeric vector giving breakpoints along the range of
    \code{z}.  See \code{\link{levelplot}} for details.
  }
  \item{shrink}{
    Either a numeric vector of length 2 (meant to work as both x and y
    components), or a list with components x and y which are numeric
    vectors of length 2.  This allows the rectangles to be scaled
    proportional to the z-value. The specification can be made
    separately for widths (x) and heights (y).  The elements of the
    length 2 numeric vector gives the minimum and maximum proportion of
    shrinkage (corresponding to min and max of z).
  }
  \item{labels}{
    Either a logical scalar indicating whether the labels are to be
    drawn, or a character or expression vector giving the labels
    associated with the \code{at} values.  Alternatively, \code{labels}
    can be a list with the following components:
    
    \describe{
    
      \item{\code{labels}:}{ a character or expression vector giving the
	labels.  This can be omitted, in which case the defaults will be
	used. }

      \item{\code{col, cex, alpha}:}{ graphical parameters for label
	texts }

      \item{\code{fontfamily, fontface, font}:}{ font used for the
	labels }
    }
    
  }
  \item{label.style}{
    Controls how label positions and rotation are determined.  A value
    of \code{"flat"} causes the label to be positioned where the contour
    is flattest, and the label is not rotated.  A value of
    \code{"align"} causes the label to be drawn as far from the
    boundaries as possible, and the label is rotated to align with the
    contour at that point.  The default is to mix these approaches,
    preferring the flattest location unless it is too close to the
    boundaries.
  }
  \item{contour}{
    A logical flag, specifying whether contour lines should be drawn.
  }
  \item{region}{
    A logical flag, specifying whether inter-contour regions should be
    filled with appropriately colored rectangles.
  }
  \item{col, lty, lwd}{ Graphical parameters for contour lines. }
  \item{border}{ Border color for rectangles used when \code{region=TRUE}. }
  \item{border.lty, border.lwd}{ Graphical parameters for the border}
%   \item{cex, col.text, font, fontfamily, fontface}{ graphical parameters for contour labels}
  \item{\dots}{ Extra parameters. }
  \item{col.regions}{
    A vector of colors, or a function to produce a vecor of colors, to
    be used if \code{region=TRUE}.  Each interval defined by \code{at}
    is assigned a color, so the number of colors actually used is one
    less than the length of \code{at}.  See \code{\link{level.colors}}
    for details on how the color assignment is done.
  }
  \item{alpha.regions}{
    numeric scalar controlling transparency of facets
  }
  \item{interpolate}{ logical, passed to \code{\link{grid.raster}}. }
  \item{identifier}{
    A character string that is prepended to the names of grobs
    that are created by this panel function.
  }
}

\details{
  The same panel function is used for both \code{levelplot} and
  \code{contourplot} (which differ only in default values of some
  arguments). \code{panel.contourplot} is a simple wrapper to
  \code{panel.levelplot}.

  When \code{contour=TRUE}, the \code{contourLines} function is used to
  calculate the contour lines.

  \code{panel.levelplot.raster} is an alternative panel function that
  uses the raster drawing abilities in R 2.11.0 and higher (through
  \code{\link{grid.raster}}).  It has fewer options (e.g., can only
  render data on an equispaced grid), but can be more efficient.  When
  using \code{panel.levelplot.raster}, it may be desirable to render the
  color key in the same way.  This is possible, but must be done
  separately; see \code{\link{levelplot}} for details.

}

\examples{

require(grid)

levelplot(rnorm(10) ~ 1:10 + sort(runif(10)), panel = panel.levelplot)

suppressWarnings(plot(levelplot(rnorm(10) ~ 1:10 + sort(runif(10)),
                                panel = panel.levelplot.raster,
                                interpolate = TRUE)))

levelplot(volcano, panel = panel.levelplot.raster)

levelplot(volcano, panel = panel.levelplot.raster,
          col.regions = topo.colors, cuts = 30, interpolate = TRUE)

}
\author{ Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}}
\seealso{
  \code{\link{levelplot}},
  \code{\link{level.colors}},
  \code{\link{contourLines}}
}
\keyword{dplot}