Because contourplot comes from the lattice package, I think you'll want to
look at these help pages:
+ help(trellis.focus)
+ help(lpoints)
Below, I've used the example from help(contourplot) to demonstrate how one
might add points and text to a lattice plot.
-tgs
#############################
# FROM help(contourplot)
require(stats)
attach(environmental)
ozo.m <- loess((ozone^(1/3)) ~ wind * temperature * radiation,
parametric = c("radiation", "wind"), span = 1, degree
= 2)
w.marginal <- seq(min(wind), max(wind), length.out = 50)
t.marginal <- seq(min(temperature), max(temperature), length.out = 50)
r.marginal <- seq(min(radiation), max(radiation), length.out = 4)
wtr.marginal <- list(wind = w.marginal, temperature = t.marginal,
radiation = r.marginal)
grid <- expand.grid(wtr.marginal)
grid[, "fit"] <- c(predict(ozo.m, grid))
contourplot(fit ~ wind * temperature | radiation, data = grid,
cuts = 10, region = TRUE,
xlab = "Wind Speed (mph)",
ylab = "Temperature (F)",
main = "Cube Root Ozone (cube root ppb)")
detach()
#######################################
# Add text and points
trellis.focus("panel", 1, 1, highlight=T)
lpoints(c(10,15),c(70,70))
ltext(10,70,"New Point",pos=3)
ltext(15,70,"New Point",pos=1)
trellis.unfocus()
On Tue, Jun 8, 2010 at 7:57 AM, biostat book <biostatbook@yahoo.com>
wrote:
> Hi All,
> I want to add one point to contourplot(). I used contourplot() in my code
> like
> contourplot(z ~ a + b |c, data)
> I understand there is plot.axes argument for filled.contour(), but it did
> not work for my code. I also tried plot() and text() for contourplot(), but
> got this error: "plot.new has not been called yet"
> Any suggestion for adding a point in contourplot()?
> Thank you very much!
> Lily D
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org 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.
>
>
[[alternative HTML version deleted]]