nossr
nossr

Reputation: 1

In RStudio gwidgets2 with Rgtk2 and ggraphics, plot has a pseudo-rubber-band box?

I want to draw a rubber-band box in a plot in a frame using gwidgets2. Unlike a plot in RStudio, a plot in a frame using gwidgets2 draws a rubber-band box unbidden. Sometimes it disappears, and sometimes it stays drawn, depending on the direction the mouse is moving at mouse-up. What is causing this, and can I access or suppress this forbidden fruit? I have not found it documented.

If not, is my best option to use locator(), or getGraphicsEvent(), or something else?

Here is code to show it. Increment with the spin button to show the plot, then rubber-band it.

library(gWidgets2)
library(gWidgets2RGtk2)
options(guiToolkit="RGtk2")
library("cairoDevice")

MyPlot <- function()
{
  updateMyPlot <- function(h,...)
  {
    plot( 1:svalue(N), type="l")
  }

  BigGroup <- ggroup( container = TopWin )
  group <- ggroup( horizontal = FALSE, container = BigGroup )

  tmp <- gframe("N", container=group, expand=TRUE)
  N <- gspinbutton(from=1, to=10, container=tmp, handler = updateMyPlot)

  add( BigGroup, ggraphics() )
}

TopWin <<- gwindow("MAIN")

MyPlot()

Upvotes: 0

Views: 156

Answers (0)

Related Questions