[an error occurred while processing this directive]
Fields: Web Manual
Table of Contents
1. Introduction

2. Thin Plate Splines: Tps 3. Spatial Process Models: Krig 4. Simulating Random Fields (sim.rf)

5. Spatial Predictions for Large Data Sets
6. Other Fields Functions References

Printable version of Fields Manual

Back to Fields Home Page
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")


This is software for statistical research and not for commercial uses. The authors do not guarantee the correctness of any function or program in this package. Any changes to the software should not be made without the authors permission.

Last modified: Dec 21 2005   by thoar@ucar.edu