newbie question about interactive plotting

I'm trying to use the pylab interface of matplotlib interactively. I'd
like to enter some commands interactively to generate some data, plot a
graph based on the data, inspect the graph, enter more interactive
python, plot another graph, and so on. Instead, what happens is either

(a) If I start with matplotlib set to interactive, control returns to
the Idle shell after the graph appears, but my graph window isn't
interactive (and most importantly, the window doesn't even refresh
properly, so if it is initially covered by the Idle window or another
window, that part of the graph isn't visible even when I put the graph
window in the foreground, or

(b) if I don't start with matplotlib in interactive mode, then to see
the graph I need to type show(). Then the graph is interactive and
refreshing works right, but the cursor doesn't return to the Idle shell,
unless I kill the graph window. At that point, any subsequent calls to
show() behave as in case (a).

My questions are:

1. Is this the expected behavior? [given the details on my setup and
procedure below]
2. Is there a way to get the type of interactivity I described in the
first paragraph of my email, other than using ipython (which I don't
particularly like because of the DOS window display, and the lack of
command completion and function argument hints which I depend on when
using GUI python shells like pythonwin or PyCrust)?
3. Is this a fundamental issue with trying to plot using an interactive
shell whose main message loop doesn't know anything about the graph
window?

I suspect the answers are yes, no (except ipython), and yes, but if so,
I'd like to have confirmation of that so I don't keep trying to bang my
head against a wall trying to figure out what I'm doing wrong.

Here are the details on what versions I'm running and what I'm trying:

I'm using matplotlib version 0.91.2 with Python 2.4.4 on Windows XP.
Following the instructions at
http://matplotlib.sourceforge.net/interactive.html, I've set my TkAgg as
my default backend and set interactive to True in my matplotlibrc file.

I generally like do my interactive python in a shell with
autocompletion. On Windows, I generally prefer PythonWin, but am open
to exploring others if PythonWin is not going to be compatible with the
matplotlib backend. For now, I'm testing with the (Tkinter-based) Idle
to avoid possible conflicts between the PythonWin mainloop.

I fire up Idle and following the example, type

  from pylab import *
  plot([1,2,3])

A new window pops up and displays my graph. However, the toolbar in the
window does not respond, and any portion of the window which was covered
by my Idle window doesn't get refreshed when I switch to the window.
This is not terribly useful.

Alternatively, if I don't set interactive in matplotlibrc, I do the same
steps and an empty window pops up. If I then type

  show()

the graph appears in that window, and refreshing and the toolbar work
fine.

I can manipulate the window and its contents with the toolbar. However,
the cursor does not return to the Idle window, so I can't plot another
graph. The only way I've been able to get the cursor to return to the
Idle window is to close the graph window (via the Windows close button).
When I do that, I can once again issue python commands interactively,
and the behavior again matches the interactive mode (so refresh doesn't
work right).

Hello,David
Just a hint.I use ipython and meet the similiar problem as you when I configure the ipython configuration file to use pylab or import pylab from the ipython command line.
The problem can be solve for me if I start ipython with the pylab ,that is I use the following command to start ipython with pylab enabled.

ipython -pylab

···

在2008-03-05,“David Fox” <David.Fox@…1916…3…> 写道:


I'm trying to use the pylab interface of matplotlib interactively. I'd
like to enter some commands interactively to generate some data, plot a
graph based on the data, inspect the graph, enter more interactive
python, plot another graph, and so on. Instead, what happens is either
(a) If I start with matplotlib set to interactive, control returns to
the Idle shell after the graph appears, but my graph window isn't
interactive (and most importantly, the window doesn't even refresh
properly, so if it is initially covered by the Idle window or another
window, that part of the graph isn't visible even when I put the graph
window in the foreground, or
(b) if I don't start with matplotlib in interactive mode, then to see
the graph I need to type show(). Then the graph is interactive and
refreshing works right, but the cursor doesn't return to the Idle shell,
unless I kill the graph window. At that point, any subsequent calls to
show() behave as in case (a).
My questions are:
1. Is this the expected behavior? [given the details on my setup and
procedure below]
2. Is there a way to get the type of interactivity I described in the
first paragraph of my email, other than using ipython (which I don't
particularly like because of the DOS window display, and the lack of
command completion and function argument hints which I depend on when
using GUI python shells like pythonwin or PyCrust)? 3. Is this a fundamental issue with trying to plot using an interactive
shell whose main message loop doesn't know anything about the graph
window?
I suspect the answers are yes, no (except ipython), and yes, but if so,
I'd like to have confirmation of that so I don't keep trying to bang my
head against a wall trying to figure out what I'm doing wrong.
Here are the details on what versions I'm running and what I'm trying:
I'm using matplotlib version 0.91.2 with Python 2.4.4 on Windows XP.
Following the instructions at
http://matplotlib.sourceforge.net/interactive.html, I've set my TkAgg as
my default backend and set interactive to True in my matplotlibrc file.
I generally like do my interactive python in a shell with
autocompletion. On Windows, I generally prefer PythonWin, but am open
to exploring others if PythonWin is not going to be compatible with the
matplotlib backend. For now, I'm testing with the (Tkinter-based) Idle
to avoid possible conflicts between the PythonWin mainloop.
I fire up Idle and following the example, type
from pylab import *
plot([1,2,3])
A new window pops up and displays my graph. However, the toolbar in the
window does not respond, and any portion of the window which was covered
by my Idle window doesn't get refreshed when I switch to the window.
This is not terribly useful.
Alternatively, if I don't set interactive in matplotlibrc, I do the same
steps and an empty window pops up. If I then type
show()
the graph appears in that window, and refreshing and the toolbar work
fine.
I can manipulate the window and its contents with the toolbar. However,
the cursor does not return to the Idle window, so I can't plot another
graph. The only way I've been able to get the cursor to return to the
Idle window is to close the graph window (via the Windows close button).
When I do that, I can once again issue python commands interactively,
and the behavior again matches the interactive mode (so refresh doesn't
work right).
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

2008年500强企业最新高薪职位,赶快了解一下

I'm trying to use the pylab interface of matplotlib interactively. I'd
like to enter some commands interactively to generate some data, plot a
graph based on the data, inspect the graph, enter more interactive
python, plot another graph, and so on. Instead, what happens is either

(a) If I start with matplotlib set to interactive, control returns to
the Idle shell after the graph appears, but my graph window isn't
interactive (and most importantly, the window doesn't even refresh
properly, so if it is initially covered by the Idle window or another
window, that part of the graph isn't visible even when I put the graph
window in the foreground, or

Are you starting idle with the -n flag? It is required for interactive
plotting with idle. Please see the users guide, which explains how to get up
and running in interactive mode quickly.

(b) if I don't start with matplotlib in interactive mode, then to see
the graph I need to type show(). Then the graph is interactive and
refreshing works right, but the cursor doesn't return to the Idle shell,
unless I kill the graph window. At that point, any subsequent calls to
show() behave as in case (a).

My questions are:

1. Is this the expected behavior? [given the details on my setup and
procedure below]
2. Is there a way to get the type of interactivity I described in the
first paragraph of my email, other than using ipython (which I don't
particularly like because of the DOS window display, and the lack of
command completion and function argument hints which I depend on when
using GUI python shells like pythonwin or PyCrust)?

ipython can give you command completion and function hints.

···

On Tuesday 04 March 2008 10:44:13 pm David Fox wrote:

Thanks, the -n flag to idle did the trick.

···

-----Original Message-----
From: Darren Dale [mailto:darren.dale@…163…]
Sent: Wednesday, March 05, 2008 7:13 AM
To: matplotlib-users@lists.sourceforge.net
Cc: David Fox
Subject: Re: [Matplotlib-users] newbie question about interactive
plotting

On Tuesday 04 March 2008 10:44:13 pm David Fox wrote:

I'm trying to use the pylab interface of matplotlib interactively.

I'd

like to enter some commands interactively to generate some data, plot

a

graph based on the data, inspect the graph, enter more interactive
python, plot another graph, and so on. Instead, what happens is

either

(a) If I start with matplotlib set to interactive, control returns to
the Idle shell after the graph appears, but my graph window isn't
interactive (and most importantly, the window doesn't even refresh
properly, so if it is initially covered by the Idle window or another
window, that part of the graph isn't visible even when I put the graph
window in the foreground, or

Are you starting idle with the -n flag? It is required for interactive
plotting with idle. Please see the users guide, which explains how to
get up
and running in interactive mode quickly.

(b) if I don't start with matplotlib in interactive mode, then to see
the graph I need to type show(). Then the graph is interactive and
refreshing works right, but the cursor doesn't return to the Idle

shell,

unless I kill the graph window. At that point, any subsequent calls

to

show() behave as in case (a).

My questions are:

1. Is this the expected behavior? [given the details on my setup and
procedure below]
2. Is there a way to get the type of interactivity I described in the
first paragraph of my email, other than using ipython (which I don't
particularly like because of the DOS window display, and the lack of
command completion and function argument hints which I depend on when
using GUI python shells like pythonwin or PyCrust)?

ipython can give you command completion and function hints.