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