Make 3D scatterplot (using colored or differentlysized points)
Description
Given a list of points' coordinates and the values
observed at those points, return a scatterplot with points located
as specified by the coordinates and coded by color and/or size to
represnt the observed value at the location. This code is basically
a wrapper for a call to the function points.geodata
in
the geoR package.
Usage
1 2 3 4 5  plot3d.points(x, y, z, zlim = range(z, na.rm = TRUE),
add = FALSE, col = heat.colors(12), xlab, ylab,
pch = 21, cex.min = 1, cex.max = 1,
symbol.border.col = "black",
plt.beyond.zlim = FALSE, ...)

Arguments
x 
xcoordinates of locations at which response values 
y 
ycoordinates of locations at which response values 
z 
Response values 
zlim 
Vector of minimum and maximum values of 
add 
If FALSE (default), the function will begin a new plot. If TRUE, adds scatterplot to a preexisting plot. 
col 
Color range to use for the scatterplot, with the first
color assigned to zlim[1] and last color assigned to zlim[2].
Default is “heat.colors(12)”, as it is for 
xlab 
The label for the xaxis. If not specified by the user,
defaults to the expression the user named as parameter 
ylab 
The label for the yaxis. If not specified by the user,
defaults to the expression the user named as parameter 
pch 
The point symbol to use. Possible values are 21, 22, 23,
24, and 25. This is because 
cex.min 
Minimum amount to shrink/expand the point symbols. 
cex.max 
Maximum amount to shrink/expand the point symbols. 
Parameters cex.min
and cex.max
control the minimum
and maximum amounts to shrink/expland the points, based on the
value of z
. By default, these are both set to one, which
makes all the points the same size. For more information, see
the help page for points.geodata
.
symbol.border.col 
This controls the color of the border around the plotting symbol. By default, it is black. If a border is not desired, use ‘symbol.border.col=“transparent”’. 
plt.beyond.zlim 
IF TRUE, and if 
... 
Any other parameters the user adds will be passed to the

Details
This function is a wrapper to the points.geodata
function in the geoR package.
Value
A scatterplot with points at (x
,y
). These points
are colored according to the correspoinding value of z
and
the colors specified in col
. They are sized according to the
corresponding value of z
and the minimum and maximum sizes
specified by cex.min
and cex.max
.
Author(s)
Jenise Swall
See Also
points.geodata
, points
Examples
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  ## Plot ozone at each location using colors from rainbow.colors
## and differentlysized points. Add a legend using function
## vertical.image.legend (included in this package).
data(ozone1)
col.rng < rev(rainbow(n=10, start=0, end=4/6))
z.rng < c(40, 90)
plot3d.points(x=ozone1$longitude, y=ozone1$latitude, z=ozone1$daily.max,
xlab="longitude", ylab="latitude", col=col.rng,
zlim=z.rng, cex.min=0.5, cex.max=1.5)
## To verify, label the points with their concentrations.
text(ozone1$longitude, ozone1$latitude+0.15, ozone1$daily.max, cex=0.7)
## If maps package is available, put on state lines.
if (require("maps")) map("state", add=TRUE, col="lightgray")
## Put on legend.
vertical.image.legend(col=col.rng, zlim=z.rng)
## Plot second day of ozone data. Note that day 2 experienced a smaller
## range of concentrations, so we plot day 2 on same scale as day 1.
data(ozone1)
data(ozone2)
z.rng < c(40, 90)
col.rng < rev(rainbow(n=10, start=0, end=4/6))
dev.new()
plot3d.points(x=ozone2$longitude, y=ozone2$latitude, z=ozone2$daily.max,
xlab="longitude", ylab="latitude", col=col.rng,
zlim=z.rng, cex.min=0.5, cex.max=1.5)
## To verify, label the points with their concentrations.
text(ozone2$longitude, ozone2$latitude+0.15, ozone2$daily.max, cex=0.7)
## If maps package is available, put on state lines.
if (require("maps")) map("state", add=TRUE, col="lightgray")
vertical.image.legend(col=col.rng, zlim=z.rng)
## When some z value(s) is/are much lower/higher than the others,
## the outlying value(s) may appear in color at the extent
## of the range, with the remainder of the data clustered in one (or
## just a few) color bin(s).
x < 1:9
y < 1:9
z < c(0, 47:53, 100)
dev.new()
par(mfrow=c(1,3))
col.rng < rev(rainbow(n=7, start=0, end=4/6))
plot3d.points(x, y, z, col=col.rng)
text(x, y+0.2, z, cex=0.8)
## In vain, you might try to "fix" this by setting zlim so that the
## color range reflects the main portion of the z values. You may
## assume that the outlying value(s) will show up in the extreme edges
## of the color range, but what will actually happen is that the
## outlying values won't be plotted.
plot3d.points(x, y, z, col=col.rng, zlim=c(47, 53))
text(x, y+0.2, z, cex=0.8)
## Instead, specify zlim to reflect the main porition of the z values,
## and set plt.beyond.zlim=TRUE. Now, z values below zlim[1] will be
## plotted in the same color as zlim[1]; those above zlim[2] will be
## plotted like z values of zlim[2]. But, remember, now there are
## outlying values whose maginitudes cannot be easily ascertained!
plot3d.points(x, y, z, zlim=c(47, 53), col=col.rng, plt.beyond.zlim=TRUE)
text(x, y+0.2, z, cex=0.8)
