image or
persp.
The user may supply an explicit list of breakpoints,
or a suggested number of classes.
hist2d(x, y, xbreaks=<<see below>>, ybreaks=<<see below>>,
nxbins=<<see below>>, nybins=<<see below>>, scale=F)
x can give both dimensions by being a list with
x and
y
components, or a matrix with two columns
(the first column is
x, the second column is
y).
Missing values are not allowed.
x data,
nxbin is ignored if
xbreaks is supplied.
y data,
nybin is ignored if
ybreaks is supplied.
TRUE,
z is scaled so that the volume under the histogram is
1.
If
FALSE,
z contains the actual counts.
x bins.
y bins.
x, and the number of
columns is the length of the output
y.
x
y
Missing values are not counted.
hist2d
calculates the counts for a 2-dimensional histogram.
These counts may be used in
persp,
image,
contour or some other
plotting routine.
The default number of bins is computed by a variant of Doane's rule
and breakpoints are chosen so that few datapoints lie on a breakpoint.
corn <- list(x = corn.rain, y = corn.yield) image(hist2d(corn, nxbins=9, ny=9)) points(corn, col=0) prim <- hist2d(prim9[,3:4], nxbin=30, nybin=30) persp(prim$z/max(prim$z), eye=c(-6, -4, 3))