addDrawingArea {iSPlot} | R Documentation |
addDrawingArea adds a drawing area to a gtk widget (it can be either a window, a pane, a notebook, a scrolled window, or a hbox or vbox). This drawing area is made into a gtk device so it can be plotted on using R functions. Two callbacks are added to the drawing area so it can respond to user interaction: button press event and motion notify event, but these callbacks are added in the function createSPlotView. Device information is stored in the plotView object, which is stored in viewList in the environment, viewEnv.
addDrawingArea(wid, dr, width, height, devVec, addType = 1, lab = "", devName = "")
wid |
the gtk widget |
dr |
the gtk drawing area |
width |
the drawing area width |
height |
the drawing area height |
devVec |
the current device vector for the gtk window that will contain this drawing area - it may be a vector of length zero if no devices have been added to this window |
addType |
an integer that can be 1, 2, 3, 4, or 5 where 1=window, 2=2nd pane, 3=notebook, 4=scrolled window, 5=hbox or vbox |
lab |
the label if adding to a notebook |
devName |
the device name |
addDrawingArea returns the number of the device that was just created.
Elizabeth Whalen
if (interactive()) { w<-gtkWindow(show=FALSE) dr<-gtkDrawingArea() devVec<-addDrawingArea(w,dr,300,300,c()) w$Show() # set these parameters to make sure the plot looks as expected par("bg"="transparent") par("col"="black") par("fg"="black") plot(1:10) # to see R's device list dev.list() # close the window and remove the device from R's device # list using dev.off }