Eric Jackson wrote:
> To address my dilemma regarding line plots, I read about matplotlib at
> http://matplotlib.sourceforge.net/users/transforms_tutorial.html.
> This is a library that a user can import into their Sage worksheet to
> allow then more flexibility with plots. When using matplotlib, the
> user may have to apply certain backends to achieve visibility of
> plots. The backend the user applies depends solely on where he/she is
> using matplotlib interactively from.
>
> A few minutes ago I published a sage worksheet called "Line Plot with
> Matplotlib". Cell 1 of this sheet shows a simple plot using a
> hardcopy backend to create a PNG file. This is an item that Jason
> Grout helped me with. Thanks Jason! Cell 2 (#Their version from
> matplotlib documentation) uses pylab instead of pyplot. The code in
> cell 2 was obtained from the matplotlib website. I could not get this
> to work, instead I inserted my own version in cell 3 (#My version),
> which produces the same plot that cell 2 would produce had it worked.
> If anybody can get cell 2 working, then that would be really cool.
You can't use "show". Use "savefig", as in:
savefig('test.png')
The sage notebook automatically displays any graphic file you generate
in a cell. That's why we need to save the figure to a graphics file,
like test.png. Then the notebook comes along, sees that the cell
generated a graphic file, and displays it.
>
> *However, the code in cell 4, is where I really need the help. The
> code in cell 4 is suppose to display the xy data at a certain location
> on the line plot. I have looked at this for a while, but I am
> confused as to why it doesn't work. This code was also taken from the
> mathplotlib website. Any help on this in particular would be neat.
> In my spare time, I will continue to work on this.
Just change the last line to "plt.savefig..." just like the first cell.
It's not "savefile", it's "savefig" :).
Thanks,
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---