demo/editRect.R

library(grid)
grid.rect(x = 0, y = 0, width = 0.1, height = 0.1,
    gp = gpar(col = NA, fill = "red"), name = "rect0")
grid.rect(x = 0.1, y = 0.9, width = 0.1, height = 0.1,
    gp = gpar(col = NA, fill = "green"), name = "rect1")
for (i in 1:100) {
    grid.edit("rect0", x = unit(i/100, "npc"), y = unit(i/100,
        "npc"), gp = gpar(fill = rainbow(100)[i]))
    Sys.sleep(0.05)
}

Try the MSG package in your browser

Any scripts or data that you put into this service are public.

MSG documentation built on July 22, 2021, 1:06 a.m.