#7665: Make support for R graphics
-----------------------------------------------------+----------------------
Reporter: kcrisman | Owner: was
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.4
Component: graphics | Keywords: plot, R,
graphics, statistics
Author: Karl-Dieter Crisman, Tim Joseph Dumol | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------------------------------+----------------------
Comment(by kcrisman):
Okay, here is something that should work and doesn't now - probably
because of the new cell structure, though perhaps it already didn't work
before, or maybe it's the fault of the r.png() setting its own path? Try
the following in the notebook (evaluated in Sage):
{{{
r.library('lattice')
r.png()
r("print(histogram(~wt | cyl, data=mtcars))")
r.dev_off()
}}}
Notice that below and to the right of the graphic there is a link for the
graphic - but there is no actual graphic at that link, because it's a link
to the /tmp directory (the actual evaluation directory), and the file
doesn't actually exist there:
{{{
Crismans-Computer:~ crisman$ ls -al
.sage/sage_notebook.sagenb/home/admin/0/cells/2/
total 40
drwx------ 4 crisman crisman 136 Apr 19 20:20 .
drwxr-xr-x 5 crisman crisman 170 Apr 19 20:14 ..
lrwxr-xr-x 1 crisman crisman 33 Apr 19 20:20 .Rplot001.png-wZKi ->
/tmp/tmp_0wLLV/.Rplot001.png-wZKi
-rwx------ 1 crisman crisman 12769 Apr 19 20:20 Rplot001.png
Crismans-Computer:~ crisman$ ls -al /tmp/tmp_0wLLV/total 16
drwx------ 4 crisman wheel 136 Apr 19 20:20 .
drwxrwxrwt 23 root wheel 782 Apr 19 20:20 ..
-rw-r--r-- 1 crisman wheel 76 Apr 19 20:20 _tmp__SAGE__CoDe__.py
lrwxr-xr-x 1 crisman wheel 59 Apr 19 20:20 data ->
/Users/crisman/.sage/sage_notebook.sagenb/home/admin/0/data
}}}
Any clue as to how to fix that? I don't understand this at all. I don't
know that this should hold things up, though, particularly since one can
either drag and drop the picture or just do it from the command line if
one wants it.
Otherwise this is all coming together nicely, also works on PPC, so I
think sufficiently robust at this point. Here is some resolution of the
original examples in command line.
{{{
sage: r.library('MASS')
sage: r.library('lattice')
sage: r.bwplot('MPG.highway ~ Origin', data = 'Cars93')
sage: r.dev_off() # Now it should be in the home directory name
Rplot001.png or something
sage: r.histogram('~ MPG.highway',data='Cars93')
sage: r.dev_off() # Now it should be in the home directory name
Rplot002.png or something
sage: r.plot('MPG.highway ~ Weight', data='Cars93') # Calls dev.off(), so
should be in home directory immediately
}}}
Great! Putting 'needs review', though presumably we'll have to do a few
more things to tie up loose ends.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7665#comment:30>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.