demo/rp.image.r

click.capture <- function(panel, x, y) 
{
print(x)
print(y)
print(panel)
  if (!is.null(panel$x))
  { 
    rp.line(panel, "gulls.image", panel$x, panel$y, as.numeric(x), as.numeric(y), color="red", width=3, id = "current")
  }
  panel$x <- x
  panel$y <- y
  panel
}

gulls.panel <- rp.control()
image.file <- file.path(system.file(package = "rpanel"), "images", "gulllmks.gif")
gulls.image <- rp.image(gulls.panel, image.file, name="gulls.image", action=click.capture, pos=list(row=0, column=0))
rp.button(gulls.panel, function(panel) { rp.clearlines(gulls.panel, "gulls.image"); panel }, "Remove lines", pos=list(row=1, column=0))

Try the rpanel package in your browser

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

rpanel documentation built on Feb. 16, 2023, 10:37 p.m.