From: Ned <a.g...@du...> - 2011-08-11 16:14:18
|
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... |
From: Benjamin R. <ben...@ou...> - 2011-08-11 16:30:25
|
On Thu, Aug 11, 2011 at 10:46 AM, Ned <a.g...@du...> wrote: > 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 |
From: Ivan D V. <iv...@ad...> - 2011-08-11 18:20:38
|
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? you can use any one of the PPAs listed here: https://launchpad.net/ubuntu/+ppas?name_filter=matplotlib 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. |
From: Ivan D V. <iv...@ad...> - 2011-08-11 18:23:42
|
On Thursday, August 11, 2011 14:20:22 you wrote: > 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. > $ 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. |