[Tutor] Closing a matplotlib window after show()
sierra_mtnview at sbcglobal.net
Mon Feb 8 20:54:27 CET 2010
When I installed matplotlib2.5 on my W7 machine last were a few error
msgs about missing about missing files. Is that usual for matplotlib.
BTW, I've posted details of my problem to the MPL list. Here I'm
interested in the basic of install and use with IDLE, and not the
details of the use of MPL. Supposedly an uninstall is provided by a
Python setup tool. I hae not used it yet.
The basic problem is the show(). One person checked out the examples I
provided and found show() to operate fine. On my XP machine the program
I'm modifying has plot code someone put in a year or two ago, and it all
works fine. My code produces the desired plot, but gets hung up on show().
On 2/7/2010 8:11 PM, Wayne Watson wrote:
> The code below is a typical example of matplotlib use. I've used it
> both in xp and win7 in IDLE. It produces the required plots and stop
> with the plot display. If I close the plot window with the x in the
> upper right corner, the shell window is left open. I have to do the
> same to close it. If I run it again, and look at the shell window, it
> looks hung up with the cursor below the >>> prompt. Ctrl-c doesn't
> break it, and I have to resort to x again. There must be some
> mechanism to insert below that allows the program to continue on and
> thus complete. Supposedly fig.close() will but I've put it in several
> places and have gotten unknown attribute to figure.
> from matplotlib.pyplot import figure, show
> from numpy import arange, pi, cos, sin, pi
> from numpy.random import rand
> # unit area ellipse
> rx, ry = 3., 1.
> area = rx * ry * pi
> theta = arange(0, 2*pi+0.01, 0.1)
> verts = zip(rx/area*cos(theta), ry/area*sin(theta))
> x,y,s,c = rand(4, 30)
> s*= 10**2.
> fig = figure()
> ax = fig.add_subplot(111)
> ax.scatter(x,y,s,c,marker=None,verts =verts)
"Crime is way down. War is declining. And that's far from the good
news." -- Steven Pinker (and other sources) Why is this true, but yet
the media says otherwise? The media knows very well how to manipulate us
(see limbic, emotion, $$). -- WTW
More information about the Tutor