On 6/2/10 12:13 PM, Vinod wrote:
On Jun 1, 7:19 pm, Jason Grout<[email protected]> wrote:
On 6/1/10 8:57 PM, Vinod wrote:
Yes, matlab does save the images properly to the directory. But the
problem here is to get the image displayed on the web browser itself.
Are you saying that in the Sage notebook:
1. You can use the above code to create a matlab plot and save it to a
specific directory (the current python directory)
but
2. the image is not picked up automatically by the Sage notebook?
Any image created in a Sage notebook cell "current directory" should be
displayed in the notebook under that cell.
Right now, matlab stores the image in this directory.
/usr/local/sage/data/extcode/matlab/user/
Is this path not a proper one for the images?
No.
Not sure how to change this to a python directory.
William said how in his message:
import os
filename = os.path.join(os.path.abspath('.'),'matlabfig1.png')
matlab.eval("h = figure('Visible', 'off')")
matlab.eval("plot(1:.1:10, sin(1:.1:10))")
out = matlab.eval("saveas(h,'%s')"%filename)
Alternatively, did you apply the patch mentioned earlier that apparently
fixes the problem? You have to apply the patch:
hg_sage.apply('http://trac.sagemath.org/sage_trac/attachment/ticket/9070/trac_9070.patch')
then do:
sage -br
from the command line to restart sage and compile the patch, and then
start the notebook server again
Then you should be able to just use the savefig command to save figures.
I don't have matlab installed, so I can't test the patch, but
apparently it worked and it is included in the next version of Sage.
Jason
--
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-support
URL: http://www.sagemath.org