[R-sig-Geo] Adding maps to a filled contour plot

Greg Snow greg.snow at ihc.com
Fri Sep 30 19:58:35 CEST 2005


try this:

filled.contour(cor.enso.map,
x=seq(-126.5625,-64.6875,,23),y=seq(23.720175,51.625732,,11),xlab='longitude',ylab='latitude',
plot.axes={map(xlim=c(-127,-65),ylim=c(23,52),add=T)  } )

The problem is that filled.contour uses the layout function to divide
the device into 2 pieces and plots the contour plot in 1 piece and the
color bar in the other.  When the function ends you have just the whole
device without the information on how it was split.

By passing the call to map in the plot.axes statement, it will plot the
map while the layout is still in effect and only plot it in the right
piece.

Hope this helps,


Greg Snow, Ph.D.
Statistical Data Center, LDS Hospital
Intermountain Health Care
greg.snow at ihc.com
(801) 408-8111

>>> "Anne Hertel" <ahertel at atmos.uiuc.edu> 09/29/05 01:42PM >>>
Hi,

I am trying to plot a filled contour map and overlay it with a map, but
I'm having trouble with the map. The map is plotted, but it is stretched
out over the color bar, and doesn't stay within the plotting area. If I
just use the 'contour' function the 'map' function works fine, but I
want the contours filled in.

Here's the code:
filled.contour(cor.enso.map,
x=seq(-126.5625,-64.6875,,23),y=seq(23.720175,51.625732,,11),xlab='longitude',ylab='latitude')
map(xlim=c(-127,-65),ylim=c(23,52),add=T)

where cor.enso.map is a matrix of size [23,11].

How do I make the map stay within the plotting area?

Thanks,
Anne Hertel


------------------------------------------------------------
Anne M. K. Hertel
Grad. Student & Research Assistant
Department of Atmospheric Sciences
University of Illinois at Urbana-Champaign
Annex II, room 204
Phone: (217) 333 6296

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch 
https://stat.ethz.ch/mailman/listinfo/r-sig-geo




More information about the R-sig-Geo mailing list