First time here? Check out the FAQ!

Ask Your Question
2

Embedding R graphics device in Sage notebook

asked 11 years ago

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.

Preview: (hide)

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 ( 11 years ago )

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 ( 11 years ago )

1 Answer

Sort by » oldest newest most voted
4

answered 11 years ago

Jesustc gravatar image

updated 11 years ago

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
Preview: (hide)
link

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 ( 11 years ago )

Kudos to Mike Hansen!

Jesustc gravatar imageJesustc ( 11 years ago )

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 ( 11 years ago )
1

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

Jesustc gravatar imageJesustc ( 11 years ago )

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 ( 11 years ago )

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: 11 years ago

Seen: 1,150 times

Last updated: May 28 '13