Interactive with standard python TkAgg...

Hi,
I'm trying to sort out interactive use with standard python but am having problems.
If I do:
import matplotlib
matplotlib.use("TkAgg")
matplotlib.interactive(True)
import pylab
pylab.ion()
pylab.plot([1,2,3,4])

Then I would expect a plot to appear. But it doesn't. I then have to call:

pylab.draw()

twice before getting the plot (the first call brings up an empty plot window, while the second displays the plot).

Then, if I do:
pylab.plot([1,2,3,2,3,4,5])
again, it does nothing, until I do
pylab.draw()

Also the window isn't sensitive to expose events - if it is blocked by another window/minimised etc, then the contents don't reappear, just go blank.

So, it is semi-interactive, in that I can use the python command line to add new lines, but I have to call draw each time (which I shouldn't have to), and also it doesn't redraw itself correctly.

Can anyone give ideas?

I'm running on ubuntu 10.04 32bit, with distro package 0.99 for matplotlib. I haven't been able to find anything that helps online either.

Thanks...

Hi,

I’m trying to sort out interactive use with standard python but am having

problems.

If I do:

import matplotlib

matplotlib.use(“TkAgg”)

matplotlib.interactive(True)

import pylab

pylab.ion()

pylab.plot([1,2,3,4])

Then I would expect a plot to appear. But it doesn’t. I then have to call:

pylab.draw()

twice before getting the plot (the first call brings up an empty plot

window, while the second displays the plot).

Then, if I do:

pylab.plot([1,2,3,2,3,4,5])

again, it does nothing, until I do

pylab.draw()

Also the window isn’t sensitive to expose events - if it is blocked by

another window/minimised etc, then the contents don’t reappear, just go

blank.

So, it is semi-interactive, in that I can use the python command line to

add new lines, but I have to call draw each time (which I shouldn’t have

to), and also it doesn’t redraw itself correctly.

Can anyone give ideas?

The problem is mostly with the version of matplotlib you have. Significant effort went into interactivity for v1.0.x, and I believe your problem would be greatly eliminated by using v1.0.1. You are right, you shouldn’t have to call draw() all the time.

I’m running on ubuntu 10.04 32bit, with distro package 0.99 for

matplotlib. I haven’t been able to find anything that helps online

either.

I don’t remember who was hosting it, but I recall someone had a matplotlib v1.0.1 PPA. I also believe that we got everything fixed for release to Debian (and thus Ubuntu) for the upcoming Ubuntu. Anybody know where that PPA is?

Ben Root

···

On Thu, Aug 11, 2011 at 10:46 AM, Ned <a.g.basden@…864…> wrote:

you can use any one of the PPAs listed here:

but i instead use the following procedure to set up all of PyLab on Ubuntu 11.04:

sudo add\-apt\-repository ppa:chris\-lea/zeromq sudo add-apt-repository ppa:pyside
sudo apt\-get update sudo apt-get build-dep python-numpy python-scipy matplotlib ipython pyzmq
sudo apt\-get install python\-pyside ln -s /usr/lib/python2.7/dist-packages/PySide /opt/adverplex/lib/python2.7/site-packages/
pip install \-\-upgrade numpy scipy ipython pyzmq pip install
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz

this has the benefit of being compatible with any virtual environment. prepend ``sudo `` to the pip
commands if your Python environment is owned by root.

···

On Thursday, August 11, 2011 11:29:57 Benjamin Root wrote:

> I'm running on ubuntu 10.04 32bit, with distro package 0.99 for
> matplotlib. I haven't been able to find anything that helps online
> either.
>
I don't remember who was hosting it, but I recall someone had a matplotlib
v1.0.1 PPA. I also believe that we got everything fixed for release to
Debian (and thus Ubuntu) for the upcoming Ubuntu. Anybody know where that
PPA is?

but i instead use the following procedure to set up all of PyLab on Ubuntu 11.04:

sudo add\-apt\-repository ppa:chris\-lea/zeromq sudo add-apt-repository ppa:pyside
sudo apt\-get update sudo apt-get build-dep python-numpy python-scipy matplotlib ipython pyzmq
sudo apt\-get install python\-pyside ln -s /usr/lib/python2.7/dist-packages/PySide /opt/adverplex/lib/python2.7/site-packages/

sorry, this line should be:
$ ln -s /usr/lib/python2.7/dist-packages/PySide {env}/lib/python2.7/site-packages/

where {env} is the location of your virtual environment. my company's standard environment happens to be
at /opt/adverplex.

···

On Thursday, August 11, 2011 14:20:22 you wrote:

pip install \-\-upgrade numpy scipy ipython pyzmq pip install
Download matplotlib-1.0.1.tar.gz (matplotlib)

this has the benefit of being compatible with any virtual environment. prepend ``sudo `` to the pip
commands if your Python environment is owned by root.