On 11/19/2012 10:41 AM, Eric Verner wrote:
When I try to plot data using matplotlib from the sage command line using
show(), nothing happens. I have done some research and tried several different
backends to matplotlib in the matplotlibrc file, including Cairo, GTK, WX, Agg,
and MacOSX, and nothing works. I have tried to install pygtk and pycairo to
Sage with no luck. Can someone give me a concise, straightforward way to get
show() to work on my computer (Mac OS X 10.6.8). I would be very grateful.
Thanks.
You can't, AFAIK. Matplotlib figures are not Sage objects. When you use
show(some_figure), it usually calls some_figure.show() which is a Sage
method.
One option for you would be to declare a simple class which takes a
matplotlib object and which has a show() method. In the show() method
you can save your figure to some temporary file and then call some image
viewer to view the file. This applies only for the command line. Look at
the very end of the output when you run the following commands, on how
to call your image viewer:
sage: p = Graphics()
sage: p.show??
Also, ticket #5128 would be of interest to you:
http://trac.sagemath.org/5128
On a notebook, you simply need to save the figure and it will
automatically be shown on the cell output. So, you would do:
<do all your matplotlib commands>
<let's suppose, for simplicity you were using pyplot>
plt.savefig('./figure.png')
and it will show up in your cell output.
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-devel?hl=en.