On 2010-04-16 7:43, Jay wrote:> Hello,
>
> I have a contourplot plot that shows the data I want. However, I would
> like to point a certain amount of points from this plot via a
> xyplot().
>
> Example:
>
> x<- seq(pi/4, 5 * pi, length.out = 100)
> y<- seq(pi/4, 5 * pi, length.out = 100)
> r<- as.vector(sqrt(outer(x^2, y^2, "+")))
> grid<- expand.grid(x=x, y=y)
> grid$z<- cos(r^2) * exp(-r/(pi^3))
> levelplot(z~x*y, grid, cuts = 50, panel.xyplot(x~y))
>
>
> But the point does not show up. What is the correct way to achieve
> this?
>
Try something like this:
levelplot(z ~ x * y, grid, cuts = 50,
panel = function(x, y, z, ...){
panel.levelplot(x, y, z, ...)
panel.points(x = c(5, 9), y = c(3, 12),
cex = 3, pch = 20, col = "red", ...)
}
)
-Peter Ehlers
> ______________________________________________
> R-help at 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.
>
>
--
Peter Ehlers
University of Calgary