Keaton Mowery | 7 Oct 09:55

Installation bug on OS X

Hey all,

I hope this is the right list for this sort of thing, but here goes.
My installation of matplotlib (via macports) bombed out with this
error:

Traceback (most recent call last):
  File "setup.py", line 125, in <module>
    if check_for_tk() or (options['build_tkagg'] is True):
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-matplotlib/work/matplotlib-0.98.3/setupext.py",
line 841, in check_for_tk
    explanation = add_tk_flags(module)
  File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-matplotlib/work/matplotlib-0.98.3/setupext.py",
line 1055, in add_tk_flags
    module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver])
UnboundLocalError: local variable 'tk_ver' referenced before assignment

I fixed it by adding
        tcl_lib_dir = ""
        tk_lib_dir = ""
        tk_ver = ""
at line 1033 in setupext.py.  That way, if we do get an exception in
the ensuing try block, the variables are still defined.  This seemed
to clear things up nicely.  Hope that's clear... feel free to ask for
any further debugging info.  Thanks!

Keaton Mowery

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
(Continue reading)

Eric Firing | 7 Oct 03:18

path simplification with nan (or move_to)

Mike, John,

Because path simplification does not work with anything but a continuous 
line, it is turned off if there are any nans in the path.  The result is 
that if one does this:

import numpy as np
xx = np.arange(200000)
yy = np.random.rand(200000)
#plot(xx, yy)
yy[1000] = np.nan
plot(xx, yy)

the plot fails with an incomplete rendering and general 
unresponsiveness; apparently some mysterious agg limit is quietly 
exceeded.  With or without the nan, this test case also shows the 
bizarre slowness of add_line that I asked about in a message yesterday, 
and that has me completely baffled.

Both of these are major problems for real-world use.

Do you have any thoughts on timing and strategy for solving this 
problem?  A few weeks ago, when the problem with nans and path 
simplification turned up, I tried to figure out what was going on and 
how to fix it, but I did not get very far.  I could try again, but as 
you know I don't get along well with C++.

I am also wondering whether more than straightforward path 
simplification with nan/moveto might be needed.  Suppose there is a 
nightmarish time series with every third point being bad, so it is 
(Continue reading)

Gregor Thalhammer | 6 Oct 17:21

scatter and alpha settings

Dear developers,

in matplotlib 0.98.3 I discoverd that in scatter individual alpha 
settings (by giving a list of rgba values) are ignered. Here an example 
that show this behaviour: All points show the same alpha value as given 
by the alpha keyword argument. (Omitting it equals to the setting alpha=1).

from pylab import *

x = [1,2,3]
y = [1,2,3]

c = [[1,0,0, 0.0],
     [1,0,0, 0.5],
     [1,0,0, 1.0]]

gca()
cla()
scatter(x,y, c=c, s = 200, alpha = 0.5)
draw()
show()

I had a look at the sources. In axes.py/scatter I simply removed the line

collection.set_alpha(alpha)

The recent svn version also contains this line.
With this change it worked as expected, also e.g. for the case of a 
single color for all points,

(Continue reading)

Randy Heiland | 6 Oct 05:03

mpl eggs and Tcl-Tk 8.5

Short/naive question:  do the mpl eggs have a dependency on Tk 8.4?

Longer question:  I'm trying to support a plugin (NLOPredict) to a  
popular molecular vis pkg (UCSF Chimera) and, no surprise, the plugin  
uses mpl.  Chimera bundles its own Python, plus all dependencies.   
The latest version switched to Python 2.5 and Tcl/Tk 8.5.  It also  
bundles numpy 1.0.4.  So I tried to install a mpl-maintenance egg  
(Windows first) that used Python 2.5 and pre-numpy 1.1 (I tried mpl  
0.91.4 and 91.2).  However, when I bring up the Chimera IDLE, I get:

 >>> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
traceback...
File "d:\chimera-1.2540\bin\lib\site-package\matplotlib-0.91.2-py2.5- 
win32.egg\matplotlib\backends\backend_tkagg.py", line 8, in <module>
    import tkagg    # Paint image to Tk photo blitter extension
  File "d:\chimera-1.2540\bin\lib\site-package\matplotlib-0.91.2- 
py2.5-win32.egg\matplotlib\backends\tkagg.py", line 1, in <module>
    import _tkagg
ImportError: DLL load failed: The specified file could not be found.

Ideas?
thanks, Randy

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Eric Firing | 6 Oct 02:46

Axes.add_line() is oddly slow?

I am getting very inconsistent timings when looking into plotting a line 
with a very large number of points.  Axes.add_line() is very slow, and 
the time is taken by Axes._update_line_limits().  But when I simply run 
the latter, on a Line2D of the same dimensions, it can be fast.

import matplotlib
matplotlib.use('template')
import numpy as np
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
ax = plt.gca()
LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
from time import time
t = time(); ax.add_line(LL); time()-t
###16.621543884277344
LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
t = time(); ax.add_line(LL); time()-t
###16.579419136047363
## We added two identical lines, each took 16 seconds.

LL = mlines.Line2D(np.arange(1.5e6), np.sin(np.arange(1.5e6)))
t = time(); ax._update_line_limits(LL); time()-t
###0.1733548641204834
## But when we made another identical line, updating the limits was
## fast.

# Below are similar experiments:
LL = mlines.Line2D(np.arange(1.5e6), 2*np.sin(np.arange(1.5e6)))
t = time(); ax._update_line_limits(LL); time()-t
###0.18362092971801758
(Continue reading)

Michael Droettboom | 2 Oct 15:47

Python 2.6

matplotlib SVN trunk appears to be running backend_driver.py fine under 
Python-2.6 with Numpy SVN and TkAgg backend.

I had to make a handful of changes to remove deprecation warnings, none 
of which changes our "still supporting Python 2.4" policy.  One change 
was required to pytz, which I've communicated upstream to its author.

In case anyone is wondering, there don't seem to be any measurable 
performance increases... :(

Cheers,
Mike

--

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Mátyás János | 2 Oct 00:43

memory leak: gtk.gdk.Pixbuf and gtk.gdk.GCX11 with gtkagg backend

Hi,

I'm looking for memory leaks in a python application and found leaks in
matplotlib. The application is graphic intensive. Each time it updates
the screen, matplotlib allocates another 5-10 megabytes memory for the
new gtk.gdk.Pixbuf and gtk.gdk.GCX11 while does not free up the buffers
allocated for the previous content.

I switched on garbage collection debugging with:

import gc
gc.enable()
gc.set_debug(gc.DEBUG_LEAK)

and tried to delete the leaking objects:

--- ./lib/matplotlib/backends/backend_gtkagg.py 2008-06-23
04:09:29.000000000 +0200 ++
+ /usr/lib/python2.4/site-packages/matplotlib-0.91.4-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py
2008-10-02 00:05:32.000000000 +0200 @@ -3,6 +3,7 @@ """
 from __future__ import division
 import os
+import gc

 import matplotlib
 from matplotlib.figure import Figure
@@ -82,8 +83,17 @@
         h = int(ren.height)
         pixbuf = gtk.gdk.pixbuf_new_from_data(
             buf, gtk.gdk.COLORSPACE_RGB,  True, 8, w, h, w*4)
(Continue reading)

Tony S Yu | 26 Sep 19:38

spy: ignore zero values in sparse matrix

When sparse matrices have explicit zero values, `axes.spy` plots those  
zero values. This behavior seems unintentional. For example, the  
following code should have a main diagonal with markers missing in the  
middle, but `spy` currently plots a full main diagonal.

#~~~~~~~~~~~
import scipy.sparse as sparse
import matplotlib.pyplot as plt

sp = sparse.spdiags([[1,1,1,0,0,0,1,1,1]], [0], 9, 9)
plt.spy(sp, marker='.')
#~~~~~~~~~~~

Below is a patch which only plots the nonzero entries in a sparse  
matrix. Note, sparse matrices with all zero entries raises an error;  
this behavior differs from dense matrices. I could change this  
behavior, but I wanted to minimize the code changed.

Cheers,

-Tony

PS: this patch also includes two trivial changes to some examples.

Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py	(revision 6122)
+++ lib/matplotlib/axes.py	(working copy)
@@ -6723,9 +6723,11 @@
          else:
(Continue reading)

Ryan May | 25 Sep 16:53

Basemap docs?

Jeff,

I just noticed that the 0.99.1 tarball for Basemap does not include a 
pdf of the docs, while 0.99 did.  Was this intentional or just an 
oversight?  I only ask because it broke the gentoo option for installing 
  the docs.

Ryan

--

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Darren Dale | 25 Sep 16:28

system fonts not found

I noticed this morning that my Times and Palatino system fonts are not being 
found anymore. I removed my fontManager.cache and ran my script with 
verbose=debug, and it looks like creatFontDict found them, but then findfont 
cant:

$ python characteristics_size_plots.py
matplotlib data path /usr/lib64/python2.5/site-packages/matplotlib/mpl-data
loaded rc file /home/darren/.matplotlib/matplotlibrc
matplotlib version 0.98.3
verbose.level debug
interactive is False
units is False
platform is linux2
loaded modules: 
['_bisect', 'numpy.ma.types', 'xml.sax.urlparse', 'distutils', 'matplotlib.errno', 'pylab',
'numpy.core.defchararray', 'xml._xmlplus', 'matplotlib.tempfile', 'distutils.sysconfig',
'ctypes._endian', 'encodings.encodings', 'matplotlib.dateutil', 'matplotlib.colors',
'numpy.core.numerictypes', 'numpy.testing.sys', 'numpy.core.info', 'xml', 'numpy.fft.types',
'numpy.ma.operator', 'distutils.dep_util', 'numpy.ma.cPickle', 'struct', 'numpy.random.info',
'tempfile', 'base64', 'numpy.linalg', 'matplotlib.threading', 'numpy.testing.operator',
'enthought.pyface', 'imp', 'numpy.testing', 'collections', 'numpy.core.umath',
'numpy.lib.pkgutil', 'pytz.os', 'numpy.lib.numpy', 'numpy.core.scalarmath', 'numpy.ma.sys',
'matplotlib.matplotlib', 'string', 'numpy.testing.os', 'matplotlib.locale', 'numpy.lib.a
 rraysetops', 'numpy.testing.unittest', 'numpy.lib.math', 'encodings.utf_8',
'matplotlib.__future__', 'pytz.tzinfo', 'numpy.testing.re', 'itertools', 'numpy.version',
'numpy.lib.re', 'distutils.re', 'ctypes.os', 'numpy.core.os', 'numpy.lib.type_check',
'httplib', 'enthought.traits', 'bisect', 'signal', 'enthought.pyface.ui', 'numpy.lib.types',
'numpy.lib._datasource', 'random', 'numpy.ma.extras', 'numpy.fft.fftpack_lite',
'matplotlib.cbook', 'ctypes.ctypes', 'xml.sax.xmlreader', 'matplotlib.pytz',
'numpy.__builtin__', 'distutils.log', 'xml.sax.saxexts', 'cStringIO', 'numpy.ma.core',
(Continue reading)

Manuel Metz | 25 Sep 15:02

[ 2126188 ]

Hi Mike,

   I just stumbled over this bug report (#2126188) on sourceforge. This 
seems to appear in version 5471, committed by you.

Manuel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane