Ask Your Question
2

Embedding R graphics device in Sage notebook

asked 2013-04-15 00:47:57 +0100

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

Comments

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 09:45:33 +0100 )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 22:25:21 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2013-04-19 05:38:49 +0100

Jesustc gravatar image

updated 2013-05-28 12:23:36 +0100

Static plots -- png device

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

Interactive graphics -- X11 device

Example:

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

Comments

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 09:42:47 +0100 )edit

Kudos to Mike Hansen!

Jesustc gravatar imageJesustc ( 2013-04-19 12:16:41 +0100 )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 22:26:51 +0100 )edit
1

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

Jesustc gravatar imageJesustc ( 2013-05-28 09:30:21 +0100 )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 12:03:10 +0100 )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

3 followers

Stats

Asked: 2013-04-15 00:47:57 +0100

Seen: 1,112 times

Last updated: May 28 '13