[R] grid.edit problem

Gabor Grothendieck ggrothendieck at gmail.com
Sat Oct 15 18:32:36 CEST 2005


Sorry, forgot to mention my system:

> R.version.string # XP
[1] "R version 2.2.0, 2005-09-20"



On 10/15/05, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> I am having a problem in editing a grob.  It works ok if I try to
> shift the grob using npc coordinates but if I do the same thing
> using native coordinates the grob disappears.  What is wrong?
>
>
> library(grid)
> grid.newpage()
>
> # create viewport
> pushViewport(viewport(xscale = c(100,200), name = "X"))
>
> # draw vertical line
> grid.lines(150, 0:1, default.units = "native",  name = "L")
>
> # move line 25% of the way to the right. Works ok.
> grid.edit("L", x = grid.get("L")$x + unit(0.25, "npc"))
>
>
> # but now repeat it shifting it using native coordinates
> ########################################################
>
> # remove line and draw a new line where the original one was
> grid.remove("L")
> grid.lines(150, 0:1, default.units = "native",  name = "L")
>
> # move line 25% of the way to the right but use native coordiantes
> #### line disappears !!!!!!!!!
> grid.edit("L", x = grid.get("L")$x + unit(25, "native"))
>




More information about the R-help mailing list