Mark Heckmann
2012-Mar-05 21:14 UTC
[R] changing the drawing context using Cairo and RGtk2
I am not too familiar with Cairo and RGtk2 and have the following problem: I have a container with two GTK drawing areas converted into Cairo devices. I know that I can set the current drawing context e.g. using dev.set(). But this is tedious. How can I set the context using the objects da1 or da2? w <- gtkWindow() w$setSizeRequest(400, 400) vbox <- gtkVBox() da1 <- gtkDrawingArea() da2 <- gtkDrawingArea() vbox$add(da1) vbox$add(da2) dummy <- asCairoDevice(da1) dummy <- asCairoDevice(da2) w$add(vbox) par(oma=c(0,0,0,0), mar=c(0,0,0,0)) plot(1:10) THX --Mark ???????????????????????????????????? Mark Heckmann Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com
Michael Lawrence
2012-Mar-06 12:52 UTC
[R] changing the drawing context using Cairo and RGtk2
Currently, the GtkDrawingArea object has no real knowledge that it is being used as a graphics device. You could do something like: stick the device ID on da1/da2 as an attribute, and then have a function that does dev.set with that attribute. Michael On Mon, Mar 5, 2012 at 1:14 PM, Mark Heckmann <mark.heckmann@gmx.de> wrote:> I am not too familiar with Cairo and RGtk2 and have the following problem: > I have a container with two GTK drawing areas converted into Cairo devices. > I know that I can set the current drawing context e.g. using dev.set(). > But this is tedious. How can I set the context using the objects da1 or > da2? > > w <- gtkWindow() > w$setSizeRequest(400, 400) > vbox <- gtkVBox() > da1 <- gtkDrawingArea() > da2 <- gtkDrawingArea() > vbox$add(da1) > vbox$add(da2) > dummy <- asCairoDevice(da1) > dummy <- asCairoDevice(da2) > w$add(vbox) > par(oma=c(0,0,0,0), mar=c(0,0,0,0)) > plot(1:10) > > THX > --Mark > –––––––––––––––––––––––––––––––––––– > Mark Heckmann > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Apparently Analagous Threads
- "figure margins too large" in RGtk2 drawing area as cairo device - why?
- RGtk2: How to overlay a gtkDrawingArea with a button or any other widget?
- pool metadata has duplicate children
- 4.8-RELEASE not identifying scsi drives
- equivalent to "require" for imports? (cairoDevice)