Display the Density of Points in a Scatter Plot by Colors
Description
The density of points in a scatter plot is encoded by color.
Usage
1 2 3 
Arguments
x, y 
Coordinates of points whose density is plotted. If

pixs 
Size of pixel in x and ydirection in [mm] on the
plotting device. When 
zmax 
Maximum number of counts per pixel in the plot. When

ztransf 
Function to transform the number of counts per
pixel, which will be mapped by the function in

colramp 
Color ramp to encode the number of the counts within a pixel by color. 
factors 
Vector of logicals indicating whether 
matrix 
Boolean. Should all counts be returned in a xyzmatrix or just the maximum. 
Details
Before calling Image
a plot must have been created by, e.g.,
calling plot(x,y,type="n")
. This function ensures
by default that the pixel has the same size in x and ydirection. As
a drawback, pixels may be unequally spaced, when there are only very
few distinct (integer) values in x or ydirection. When this is the
case, the corresponding dimension should be declared as a factor.
(cf. argument factors
).
This function is based on graphics
Value
Maximum number of counts per pixel found (matrix = FALSE
) or
the full matrix.
Author(s)
Andreas Ruckstuhl, Rene Locher
See Also
ipairs
, ilagplot
,
iplot
, image
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  plot.default(iris$Species, iris$Petal.Width, xlim=c(0.5,3.5),
type="n", axes=FALSE)
axis(1, at=1:3, labels=levels(iris$Species))
axis(2)
Image(iris$Species, iris$Petal.Width, pixs=3)
##
x < rnorm(10000)
y < rnorm(10000, 10)
plot(x+y, y, type="n")
Image(x+y, y)
abline(a=0, b=1)
## The above can be merged to
iplot(x+y, y, legend=FALSE, oma=c(5, 4, 4, 2) + 0.1)
abline(a=0, b=1)
