Hi Ondrej,

I'm not sure where to find a good explanation of that, but let me give you 
some hints. It is intended to use show only once per program. Namely 'show' 
should be the last line in your script. If you want interactive plotting you 
may consider interactive mode (pyplot.ion-ioff) like in the example below. 

Furthermore for dynamic plotting all animation demos might be useful.

Maybe you want to have also a look at 
http://matplotlib.sourceforge.net/users/shell.html .

best regards Matthias

####################
from pylab import *

t = linspace(0.0, pi, 100)
x = cos(t)
y = sin(t)

ion()  # turn on interactive mode
figure(0)
subplot(111, autoscale_on=False, xlim=(-1.2, 1.2), ylim=(-.2, 1.2))

point = plot([x[0]], [y[0]], marker='o', mfc='r', ms=3)

for j in arange(len(t)):
    # reset x/y-data of point
    setp(point[0], data=(x[j], y[j]))
    draw() # redraw current figure

ioff() # turn off interactive mode
show()
################

On Monday 06 July 2009 08:13:37 Ondrej Certik wrote:
> On Tue, Jun 30, 2009 at 12:09 PM, Ondrej Certik<ond...@certik.cz> wrote:
> > Hi,
> >
> > this must have been answered many times already, but I searched the
> > archives, online docs, but couldn't find anything.
> >
> > If I do:
> >
> > $ python
> > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
> > [GCC 4.3.3] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >
> >>>> import pylab
> >>>> pylab.plot([1, 3, 3])
> >
> > [<matplotlib.lines.Line2D object at 0x2154350>]
> >
> >>>> pylab.show()
> >>>> pylab.show()
> >
> > the first pylab.show() shows the plot and stays hanging (this is ok)
> > and then if I close it, to get back to the shell, the second call to
> > show() does nothing.
> >
> > One fix is to use:
> >
> > ipython --pylab
> >
> > but if I just want to call regular python, or from my own script ---
> > how do I plot for the second time?
>
> I still haven't figured out how to fix it, so any feedback would be
> appreciated.
>
> Thanks,
> Ondrej


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to