* John Hunter <[EMAIL PROTECTED]> [070611 16:20]:
> So the answer of which is better is a question of skill level and
> context, but my simple advice is to use the pylab syntax from the
> interactive python shell (and "ipython -pylab" is ideal for this) and
> the API everywhere else.  Most of my scripts are variants of this:
> 
>   import numpy as npy
>   from pylab import figure, close, show
>   fig = figure()
>   ax = fig.add_subplot(111)
>   x = npy.arange(0,10.)
>   ax.plot(x)
>   show()

Hello,

is there also a (possible object oriented) way to show/print a given
figure? Like fig.show() or fig.print_figure(). I need it because I have
a script generating (returning) several plots, and the user should be
able to print/show the plots he likes. At the moment I use:

ipython -pylab
  from myscript import plotgenerator 
  fig = plotgenerator()
  canvas = get_current_fig_manager().canvas
  canvas.figure = fig
  canvas.print_figure('myplot.png')

Here plotgenerator does something like:
  from matplotlib.figure import Figure
  fig = Figure()
  ax = myplot.add_subplot(111)
  ax.plot(x)

But its cumbersome, and canvas.show() doesn not work (it gives an
exception). Best would be if fig.show() (popping up a new canvas) and
fig.print_figure() worked.

Best Regards, Roman

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to