Dear Deepayan Thank you for your response - it has proved very very helpful, I can't thank you enough!
I have another question for you if you have time to reply. I know you have been asked about the colour of the polygon outline before (27 April 2007) and you replied that is a bug and the border can only be black or transparent... I was wondering if you have found a way to change the colour of the outline since this correspondence? If not please can you tell me how to get around this myself? You mentioned writing a replacement to lpolygon - I do not know how to do this - would it be possible for you to guide me further? I would really benefit from having the border of the polygon in white as it goes over the "sea" which is also white and would therefore only be seen over the "land", much neater! Many thanks, Jenny On 7/24/07, Jenny Barnes <jmb_at_mssl.ucl.ac.uk> wrote: > Dear R-Help community, > > I am trying to overlay a single contour line over a correlation plot using > levelplot in the lattice package. These are the two arrays: > > 1) a correlation plot over Africa - so each grid square is a different colour > dependent on correlation - this is in an array: result_cor with dim[465,465] > > 2) a single contour line from a ***different data source*** - this is from data > related to the p-values for the above correlation plot - I want to overlay only > the 95% confidence contour. The p-values are stored in an array: result.p.values > with same dimensions as above. > > I have read about using panel.levelplot and panel.contourplot in the R-help > mailing list but I don't know the right way to call two different data arrays, > can anybody help me please? I appreciate your time and help with this question. I can think of a couple of different ways, but the simplest will probably be to compute the single contour beforehand and add it after the standard levelplot using a panel function. E.g., using the 'volcano' data for both matrices: ## you need the explicit x and y arguments because ## the default is different from levelplot. vcl <- contourLines(x = seq_len(nrow(volcano)), y = seq_len(ncol(volcano)), z = volcano, levels = c(172, 182)) levelplot(volcano, add.cl = vcl, panel = function(..., add.cl) { panel.levelplot(...) lapply(add.cl, panel.polygon, border = 'red') }) -Deepayan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jennifer Barnes PhD student: long range drought prediction Climate Extremes Group Department of Space and Climate Physics University College London Holmbury St Mary Dorking, Surrey, RH5 6NT Web: http://climate.mssl.ucl.ac.uk ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.