[R] levelplot and points

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 5 11:52:41 CEST 2003


Don't attempt mix lattice and base graphics, and you cannot add to lattice 
graphics after they have been plotted.

>From MASS4:

levelplot(pred ~ x * y, topo.plt, aspect = 1,
   at = seq(690, 960, 10), xlab = "", ylab = "",
   panel = function(x, y, subscripts, ...) {
      panel.levelplot(x, y, subscripts, ...)
      panel.xyplot(topo$x,topo$y, cex = 0.5, col = 1)
   }
)

to add points to a levelplot.

On Tue, 5 Aug 2003, Theodore Kypraios wrote:

> I face the following problem. 
> 
> I have two variables x,y. I have also calculated the surface z.
> When I am drawing the surface with function >levelplot (in library lattice)  everything is OK. I have the legend etc ...
> 
> Then I am trying to plot x,y on the same graph. So I am doing :
> >points(x,y)
> 
> But, the points are not in the correct position. They are a little bit shifted to the left..(i think)
> 
> Any suggestions are really appreciated. 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list