Ask Your Question

Embedding R graphics device in Sage notebook

asked 2013-04-14 17:47:57 -0500

jaia gravatar image

Is it possible to embed an R graphics device (say, X11) in the Sage notebook rather than having it appear in a new window? I'm designing an interactive where this would be useful.

edit retag flag offensive close merge delete


Probably in principle, but it would take a significant amount of work, and would only work locally, presumably? You may find RStudio more congenial for your needs - it's a great product, and Affero GPL!

kcrisman gravatar imagekcrisman ( 2013-04-15 02:45:33 -0500 )edit

That won't help, as what I really want is to have an R graphics device as part of a Sage interactive. Sorry; guess I should have said so in the original question.

jaia gravatar imagejaia ( 2013-05-27 15:25:21 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-18 22:38:49 -0500

Jesustc gravatar image

updated 2013-05-28 05:23:36 -0500

Static plots -- png device

The answer seems to be the png device: see the accepted answer of this question.

Interactive graphics -- X11 device


sage: r.X11()    # pc-only
sage: r.quartz() # mac-only
sage: r.hist("rnorm(100)") # place your plot here
sage: r.locator(1) # example of interactivity: locate mouse "data" coordinates
edit flag offensive delete link more


Great answer - which I should have been totally aware of. I didn't think of this as a device, was thinking of the popup devices...

kcrisman gravatar imagekcrisman ( 2013-04-19 02:42:47 -0500 )edit

Kudos to Mike Hansen!

Jesustc gravatar imageJesustc ( 2013-04-19 05:16:41 -0500 )edit

Makes sense, but I want an R graphics device in order to use its clickable functionality (locate the cursor by clicking on the screen).

jaia gravatar imagejaia ( 2013-05-27 15:26:51 -0500 )edit

@jaia: Answer edited. There you have it ;)

Jesustc gravatar imageJesustc ( 2013-05-28 02:30:21 -0500 )edit

I didn't know this would work - awesome! Just as an FYI to future readers of this... you *do* have to presumably have x11 support compiled in, which we have turned off by default on Mac, so this may not work there; instead, embedding the "quartz" device should work.

kcrisman gravatar imagekcrisman ( 2013-05-28 05:03:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-04-14 17:47:57 -0500

Seen: 596 times

Last updated: May 28 '13