[R] combine trellis lattice contour plot with simple plot() points() and text() commands?
David Winsemius
dwinsemius at comcast.net
Tue Jun 2 02:22:10 CEST 2015
On Jun 1, 2015, at 2:03 PM, ivo welch wrote:
> can I add ordinary graphics commands to a contourplot? my naive
> attempts are telling me that plot.new() has not yet been called when I
> try to add text(1,1,"hi") or points( c(0,1), c(1,0) )?
There are lattice equivalents to many of the base primitives. They can be used inside lattice/trellis functions or used later if the plots have been save to names.
?llines
?trellis.focus
Also take a look at the lattice Extra and gridBase packages for additional faclities like these.
Examples requested for demonstration ... as always but using your earleir example:
myplot= contourplot( z ~ x * y, data = d)
myplot
trellis.focus("panel",1,1)
llines(x=3, y=1:5) #draws a blue segment on the screen device
NULL
trellis.unfocus()
But that is not going to change myplot. For that you need ?update.trellis or latticeExtra's version of "+".
--
david.
>
> [or do I need to rewrite another contourplot with the old graphics
> system. the basics are probably looking at adjacent points,
> pretending that they are linear, and mark where a line between them
> intercepts the level, and then hope that some sanity prevents me from
> connecting disconnected levels. not my plan...]
>
> ----
> Ivo Welch (ivo.welch at gmail.com)
> http://www.ivo-welch.info/
>
> ____
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list