Daniel Kornhauser
2009-Jan-21 08:46 UTC
[R] Can I add a point to a pointsGrob from an xyplot without redrawing ?
Hi:
I am a newbie using grid and lattice.
I want to update a xyplot without redrawing and I was wondering if there is
a way of adding a point to a pointsGrob ?
For example, take the example from the "R Graphics Book" page
218-219:
grid.newpage()
angle <- seq(0, 2*pi, length=21)[-21]
x <- cos(angle)
y <- sin(angle)
xyplot( y ~ x, aspect = 1)
Lets say I take the pointsGrob below:
getNames()
[1] "GRID.rect.748" "plot1.xlab"
"plot1.ylab"
"GRID.segments.749"
[5] "GRID.segments.750" "GRID.text.751"
"GRID.segments.752"
"GRID.text.753"
[9] "GRID.segments.754" "GRID.points.755"
"GRID.rect.756"
pg = grid.get("GRID.points", grep=TRUE)
pg
points[GRID.points.755]
Is there a way I can add a point to pg (or "GRID.points.755") to
update the
xyplot without redrawing all the points ?
If redrawing is obligatory, is there way of redrawing the least elements of
the xyplot ?
Searched for a long time but could not find anything, even if this seems
like a fairly basic operation.
I guess this may well go against the grid's package "philosophy"
or
"architecture" ?
Thanks.
Daniel.
[[alternative HTML version deleted]]
Mark Difford
2009-Jan-21 09:01 UTC
[R] Can I add a point to a pointsGrob from an xyplot without redrawing ?
Hi Daniel,>> Is there a way I can add a point to pg (or "GRID.points.755") to update >> the >> xyplot without redrawing all the points ?I think you want to look at ?grid.edit to do this. grid.edit(yourGROB, redraw = FALSE) HTH, Mark. Daniel Kornhauser-3 wrote:> > Hi: > > I am a newbie using grid and lattice. > I want to update a xyplot without redrawing and I was wondering if there > is > a way of adding a point to a pointsGrob ? > > For example, take the example from the "R Graphics Book" page 218-219: > grid.newpage() > angle <- seq(0, 2*pi, length=21)[-21] > x <- cos(angle) > y <- sin(angle) > xyplot( y ~ x, aspect = 1) > > Lets say I take the pointsGrob below: > > getNames() > [1] "GRID.rect.748" "plot1.xlab" "plot1.ylab" > "GRID.segments.749" > [5] "GRID.segments.750" "GRID.text.751" "GRID.segments.752" > "GRID.text.753" > [9] "GRID.segments.754" "GRID.points.755" "GRID.rect.756" > pg = grid.get("GRID.points", grep=TRUE) > pg > points[GRID.points.755] > > Is there a way I can add a point to pg (or "GRID.points.755") to update > the > xyplot without redrawing all the points ? > If redrawing is obligatory, is there way of redrawing the least elements > of > the xyplot ? > > Searched for a long time but could not find anything, even if this seems > like a fairly basic operation. > I guess this may well go against the grid's package "philosophy" or > "architecture" ? > > Thanks. > > Daniel. > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/Can-I-add-a-point-to-a-pointsGrob-from-an-xyplot-without-redrawing---tp21579096p21579234.html Sent from the R help mailing list archive at Nabble.com.