[R] Manipulating contour plots

Caroline Houldcroft c.j.houldcroft at swansea.ac.uk
Wed Dec 1 16:16:55 CET 2004


Dear R users,

I would like to create a filled.contour plot with colour bar and overlay
a map.

I need to create several of these representing variables with different
spatial extents for comparison. When I try to fix the plot area size and
axes limits as follows:

par(fig=c(0,1.0,0.3125,1.0)

filled.contour(x=seq((320/2)-180.5,(480/2)-180.5,len=nrow(oct94)),
y=seq((190/2)-90.5,(240/2)-90.5,len=ncol(oct94)),
z=as.matrix(oct94),
color=heat.colors,
levels=seq(0,30,2),
plot.axes={axis(1,seq(-60,60,by=20));
axis(2,seq(5,30,by=5))})


my definitions were ignored producing a stretched image of the area with
limits defined by the contour plot.  


I have also had difficulties overlaying a map on the same axes. The
following example, taken from the r-help archives, gave the error
"couldn't find function "world""

library(maps)
filled.contour(x=seq((320/2)-180.5,(480/2)-180.5,len=nrow(oct94)),
y=seq((190/2)-90.5,(240/2)-90.5,len=ncol(oct94)),
z=as.matrix(oct94),
color=heat.colors,
levels=seq(0,30,2),
plot.axes={world(ylim=c(5,30),xlim=c(-30,50),add=T);
axis(1);axis(2)})

I would be very grateful for any help with these problems.

Caroline Houldcroft




More information about the R-help mailing list