Coordinates of points whose density is plotted. If
x is a matrix or a data.frame, the first two column are used
as x and y respectively. y must be in this case NULL.
x and y may be numeric or factor variable.
pixs
Size of pixel in x- and y-direction in [mm] on the
plotting device. When x and y are numeric,
pixels are square. When x and y are factors or should
be handled as factors (see argument factors), pixels are no
longer square. The pixels are enlarged in the dimension in which the
factors are displayed, so that the rectangular pixels are centered
at the factor levels.
zmax
Maximum number of counts per pixel in the plot. When
NULL, the density in the scatter plot is encoded from 0
to maximum number of counts per pixel observed. zmax must be
equal or larger than maximum number of counts found. The maximum
number of counts per pixel is delivered by the return value.
ztransf
Function to transform the number of counts per
pixel, which will be mapped by the function in
colramp to well defined colors. The user
has to make sure that the transformed density lies in the range
[0,zmax], where zmax is any positive number (>=2). For examples see
ipairs and ilagplot.
colramp
Color ramp to encode the number of the counts within a
pixel by color.
factors
Vector of logicals indicating whether x and / or
y should be handled as factors
independently of their class.
matrix
Boolean. Should all counts be returned in a xyz-matrix
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 y-direction. As
a drawback, pixels may be unequally spaced, when there are only very
few distinct (integer) values in x- or y-direction. 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
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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(IDPmisc)
Loading required package: grid
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IDPmisc/Image.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Image
> ### Title: Display the Density of Points in a Scatter Plot by Colors
> ### Aliases: Image
> ### Keywords: aplot
>
> ### ** Examples
>
> 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)
>
>
>
>
>
> dev.off()
null device
1
>