[R] overlaying multiple contour plots

David Winsemius dwinsemius at comcast.net
Wed Oct 13 18:08:06 CEST 2010


On Oct 13, 2010, at 11:44 AM, Jeremy Olson wrote:

> Dear All,
>
> I have 4 or 5 contour plots that I need to overlay. Currently they  
> are maps showing hot and cold areas for specific elements.

Providing paste-able examples is the standard way to present such  
problems.

> I would like to combine these plots into one map, where each color  
> will correspond to a different element and you would be able to see  
> the areas that each element occupies on this map.

Hopefully there is not much overlap , so dealing with the collisions/ 
overlap is not a major issue?

> Is there a way to do this in 'R'? I am fairly new to this software,  
> so any help would be much appreciated.
> Thank you in advance,

First, specify the plotting paradigm to be used (base, lattice, ggplot2)
If base, then the "new=TRUE" parameter in par (and don't complain to  
me if you think new=TRUE is a weird construction for keeping the old  
plot active and adding additional elements. I find it backwards to how  
I think "new" would be interpreted.) You will need to repeated invoke  
par)new="TRUE" before each addition.

If lattice, probably panel.superpose(), which I don't really  
understand very well, but I'm learning slowly.

If ggplot2, someone with experience will come along and advise us.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list