|
|
General Plot of the Ozone Data
# -- Open a graphical display window.
plot.window()
# -- Create the plot base, but without the points yet (type="n"). We will add
# -- the points next. I used xlim and ylim to make a slightly nicer looking
# -- plot, but this is not necessary.
a <- 0.25 # -- change this value to zoom in and out.
# -- Close-up (and contour) uses a = 0.25.
# -- Zoomed-out uses a = 10.
# -- Plot window range.
rx <- c( min( ozone$lon.lat[,1]) - a, max( ozone$lon.lat[,1]) + a)
ry <- c( min( ozone$lon.lat[,2]) - a, max( ozone$lon.lat[,2]) + a)
plot( ozone$lon.lat[,1],
ozone$lon.lat[,2],
type="n",
xlim=rx,
ylim=ry,
xlab="East-West",
ylab="North-South")
# -- Optional colorization of plot.
# -- Create vector to colorize plot by levels of ozone in the atmosphere.
ocol <- c(2, 1, 1, 1, 3, 4, 3, 3, 6, 3, 5, 4, 5, 4, 5, 6, 2, 7, 5, 7)
# -- Now we will plot the points using the actual ozone concentrations on the
# -- plot at the corresponding lon and lat. I have also added color strictly
# -- for appearances (col=ocol).
text( ozone$lon.lat[,1],
ozone$lon.lat[,2],
labels=ozone$y,
col=ocol)
# -- superimpose a map of the region onto the plot.
usa( add=T, xlim = rx, ylim = ry, lty=2)
title("Ozone Concentrations in the Midwestern U.S.")
# -- The Contour Plot. Use same steps as above, but add contour lines.
intrp <- interp( ozone$lon.lat[,1], ozone$lon.lat[,2], ozone$y)
contour( intrp, add=T, labex=0)
# -- To plot the standard errors of the krig fit with contours. Do same as
# -- above, except use the se object (ozone.fit.se) instead of ozone$y
# -- Surface Plot. (ozone.fit is Krig object)
look<- predict.surface( ozone.fit)
image.plot( look, graphics.reset=F)
look2<- predict.surface.se( ozone.fit)
contour( look2, add=T)
title("Ozone Data Example: Surface Plot w/ Standard Error Contour Lines")
|