show()

Is there another way I am supposed to be achieving this

    > behavior? And can the warning be elaborated a bit, so it is
    > clearer why this is a bad idea?

In truth, the latest release of matplotlib sets a flag on show to
prevent repeated calls from doing any real damage.

But for classroom use, I suggest you just put "interactive : True" in
your rc file and then you have no need for show. Is there a downside
to this approach?

JDH

I'm not sure.

There are two different classroom situations.

i. ad hoc drawing in the classroom from a Python shell.
Here setting interactive makes good sense, it seems.

ii. running prepared scripts for prepared graphical
illustrations. Here I will usually have several
figures that I want displayed sequentially.
With interactive=False, this approach seems to work fine:
I close a figure and the next appears (TKAgg).
With interactive=True (and the show commands removed),
this approach seems to choke with an abnormal program termination:
Fatal Python Error: PyEval_RestoreThread: NULL tstate

Since I wish to do both, I decided I shd have
interactive:False
in my rc file. Am I overlooking something?

Thanks,
Alan

···

On Mon, 27 Sep 2004, John Hunter apparently wrote:

But for classroom use, I suggest you just put "interactive
: True" in your rc file and then you have no need for
show. Is there a downside to this approach?

Hi:

Want to inquire about gnuplot's 'steps' like functionality in matplotlib's plotting. A good example is show here:

http://chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/steps.htm

In a most hack-ish way possible, for the sake of testing I tried this (modified simple_plot.py example):

···

--------------
#!/usr/bin/env python

from matplotlib.matlab import *

figure(1)
t = arange(0.0, 1.0, 0.01)
s = sin(2*2*pi*t)

t2=concatenate((t[1:], array([t[-1]])), 1)
s2=concatenate((array([s[0]]), s[:-1]), 1)

hlines(s, t, t2)
vlines(t, s, s2)

gca().autoscale_view() #Using 60.2; need to call this for the the parts below y=0 to be visible

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')'
grid(True)
#axis([0,1,-1,1])
savefig('simple_plot')

show()
-------------

It seems to work quite nicely, but I think an ideal way of doing this would be to incorporate it into the plot() command. Perhaps adding an option 'steps' (following gnuplot's convention could have steps equal 'histeps', 'fsteps' or just 'steps' - see link above.. None could mean regular plot() behavior). I would say this would be the most elegant option, but probably would call for John (or someone else from the core developers) to make the changes. Alternatively we could use above and wrap it in a plot_step() function.

Any interest in this? If so which way do we want to go?

Peter