On 7/11/07, Ted Kosan <[EMAIL PROTECTED]> wrote: > > I would like to plot a list of values on a semi log graph and I think > that matplotlib.pylab.semilogy has the functionality I need. Can > someone post a short example of the best way to access > matplotlib.pylab.semilogy from within SAGE? > > I have been studying SAGE's plot module's source code for clues on how > to do this but I have not had much luck so far.
Fortunately, because of some well-thought out ideas in designing the SAGE notebook (thanks Tom Boothby!) It is very easy to produce graphics that embed in the notebook even if SAGE doesn't have any explicit support for them. For example, you can easily do *any* example in the entire matplotlib documentation directly as follows (this is just the first complicated example from the matplotlib examples): # ------------- from pylab import * t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) plot(t, s, linewidth=1.0) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) savefig('sage.png') # -------------- (I posted this at https://sage.math.washington.edu:8103/home/pub/1463/ ) The key point above is that we call savefig to save the current maplotlib image to a file -- when done in the notebook, it will notice that a new file was created and display it immediately. Presumably on the command line it will produce an image. I've always planned to make it a lot clearer to people that SAGE comes standard with a complete clone implementation of matlab's 2d plotting functionality... This should really go right in the tutorial and in the documentation for SAGE's current plotting code. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---