Try levelplot in package lattice instead of filled.contour: you will
be able to annotate the plot using the grid package. Moreover, you can
remove the key using the colorkey argument.
library(lattice)
library(grid)
z <- as.matrix(read.table("hist_2d"))
dimnames(z) <- NULL
Data <- expand.grid(x = seq(-4.45, 4.45, len = 90),
y = seq(-4.45, 4.45, len = 90))
Data$z <- c(z)
rm(z)
Cols <- colorRampPalette(c("white", "blue","yellow","red"))
levelplot(z ~ x * y, data = Data,
aspect = 1, colorkey = FALSE, col.regions = Cols(6),
panel = function(...){
panel.levelplot(...)
grid.circle(x = 0.62, y = 0, r = 2.5, default.units = "native")
})
Best,
Renaud
2006/12/17, Webmaster <webmaster at citedesjeunes.com>:
The output produced by 'filled.contour' is actually a combination
of two plots; one is the filled contour and one is the legend.
Two separate coordinate systems are set up for these two plots,
but they are only used internally - once the function has
returned
these coordinate systems are lost. If you want to annotate the
main contour plot, for example to add points, you can specify
graphics commands in the 'plot.axes' argument. An example is
given below.
Thanks!
I now have another question (hopefully the last) for which I couldn't
find an answer in the mailing-list archives: how can I get rid of the
color key on the contour.filled() plot? I that question, unanswered,
in a post one year ago on this same list, so I hope it's by any mean
possible... (I think it's possible to change the code completely and
use image(), but it's much less pretty).
FX