[sage-support] Re: Making pylab.plot() and pylab.show() in Sage

2009-03-16 Thread Stan Schymanski

Hi Gus,

What's wrong with Mike Hansen's suggestion in this thread?

In order to get that to work in the notebook, you don't want to use
pylab.show().  Instead, you'll want to use pylab.savefig('fig.png')
which will save the plot to a png file.

fig.png should be a separate file in your notebook folder.

Stan


linuxgus wrote:
 Thanks to all of you for responding.

 This thread brings up another interesting question:  How can I
 actually tell sage to save the graphics image to a separate file, in
 addition to displaying it?

 TIA for your response.

 Gus

 
   


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Making pylab.plot() and pylab.show() in Sage

2009-03-15 Thread linuxgus

Thanks to all of you for responding.

This thread brings up another interesting question:  How can I
actually tell sage to save the graphics image to a separate file, in
addition to displaying it?

TIA for your response.

Gus

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Making pylab.plot() and pylab.show() in Sage

2009-03-08 Thread maxthemo...@googlemail.com

Hi,

There is axis() which sets/gets the axis limits in addition to xlim()
and ylim. I don't know if it is exactly want you want as it is not a
method on the plot object. I think it returns the limits of the
current plot or figure.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axis

using the trac example:
A=random_matrix(RDF,100)
A.numpy()
import pylab
import numpy
B=A.numpy().astype(float)
im = pylab.imshow(B/numpy.max(B),  origin='upper',alpha=0.6)
lim = pylab.axis()

Cheers,
Adam


 Seehttp://trac.sagemath.org/sage_trac/ticket/5128

 There is still a problem with the posted patch which I'm sure would be
 easy for someone familiar with matplotlib to fix.  If you know how (or
 if anyone knows how) to get the min/max x-coordinates and the min/max
 y-coordinates of generic matplotlib figure/object/whatever would be
 passed in, that is what is still needed.

 Jason
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Making pylab.plot() and pylab.show() in Sage

2009-03-07 Thread Mike Hansen

Hi Gus,

On Sat, Mar 7, 2009 at 8:26 AM, linuxgus ka8...@amsat.org wrote:

 In notebook, after importing pylab, running something like

 pylab.plot([1,2,3],[1,2,3])
 pylab.show()

 does nothing.  Doing it from the command line results in a cryptic
 message about using matplotlib.use() to declare a GUI backend.  Can
 somebody show me how make pylab.plot() and pylab.show() work in
 notebook?

In order to get that to work in the notebook, you don't want to use
pylab.show().  Instead, you'll want to use pylab.savefig('fig.png')
which will save the plot to a png file.  The notebook will then
automatically detect that a png file has been created and
automatically display it in the browser.

--Mike

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Making pylab.plot() and pylab.show() in Sage

2009-03-07 Thread Jason Grout

Mike Hansen wrote:
 Hi Gus,
 
 On Sat, Mar 7, 2009 at 8:26 AM, linuxgus ka8...@amsat.org wrote:
 In notebook, after importing pylab, running something like

 pylab.plot([1,2,3],[1,2,3])
 pylab.show()

 does nothing.  Doing it from the command line results in a cryptic
 message about using matplotlib.use() to declare a GUI backend.  Can
 somebody show me how make pylab.plot() and pylab.show() work in
 notebook?
 
 In order to get that to work in the notebook, you don't want to use
 pylab.show().  Instead, you'll want to use pylab.savefig('fig.png')
 which will save the plot to a png file.  The notebook will then
 automatically detect that a png file has been created and
 automatically display it in the browser.
 

There is some preliminary work to wrap matplotlib figures in Graphics 
objects, so you could do:

Graphics(pylab.plot(...))

and Sage would treat it like any other Sage graphics object (i.e., you 
could add it to other things, etc.)

See http://trac.sagemath.org/sage_trac/ticket/5128

There is still a problem with the posted patch which I'm sure would be 
easy for someone familiar with matplotlib to fix.  If you know how (or 
if anyone knows how) to get the min/max x-coordinates and the min/max 
y-coordinates of generic matplotlib figure/object/whatever would be 
passed in, that is what is still needed.

Jason


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---