Hi On 17 Dec 2006 at 10:04, Duncan Murdoch wrote:
Date sent: Sun, 17 Dec 2006 10:04:37 -0500 From: Duncan Murdoch <[EMAIL PROTECTED]> To: Webmaster <[EMAIL PROTECTED]> Copies to: r-help@stat.math.ethz.ch Subject: Re: [R] Draw a circle on a filled.contour() plot > On 12/17/2006 9:31 AM, Webmaster wrote: > >> 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). You possibly can use image(...) contour(..., add=T) to get contours overlayed e.g. x <- y <- seq(-4*pi, 4*pi, len=27) r <- sqrt(outer(x^2, y^2, "+")) image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32)) image(z, axes = FALSE, main = "Math can be beautiful ...", xlab = expression(cos(r^2) * e^{-r/6})) contour(z, add = TRUE, drawlabels = FALSE) HTH Petr > > I don't see any option in there, so you might have to write your own > version to do it. The source for the regular function is in > > http://svn.r-project.org/R/trunk/src/library/graphics/R/filled.contour > .R > > and the part that plots the key is > > ## Plot the 'plot key' (scale): > mar <- mar.orig > mar[4] <- mar[2] > mar[2] <- 1 > par(mar = mar) > plot.new() > plot.window(xlim=c(0,1), ylim=range(levels), xaxs="i", yaxs="i") > rect(0, levels[-length(levels)], 1, levels[-1], col = col) if > (missing(key.axes)) { > if (axes) > axis(4) > } > else key.axes > box() > if (!missing(key.title)) > key.title > > You'd probably also want to change the layout, because you won't want > the blank space there. Or possibly you could get the results you want > from contour(), which doesn't plot the scale. > > Duncan Murdoch > > ______________________________________________ > 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. Petr Pikal [EMAIL PROTECTED] ______________________________________________ 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.