I get an exception when I set up a bar chart with a picker that has a
bar with 0 height, and I click on the chart.
Code to generate exception:
from matplotlib.pyplot import figure, show
import numpy as np
def onpick1(event):
print 'foo'
fig = figure()
ax = fig.add_subplot(111)
xdata = [1, 2, 3]
ydata = [1, 0, 3] #change to [1, 2, 3] and code will run fine
ax.bar(xdata,
ydata,
picker = True)
fig.canvas.mpl_connect(‘pick_event’, onpick1)
show()
#now click on chart
···
Exception generated:
Exception in Tkinter callback
Traceback (most recent call last):
File “C:\Python24\lib\lib-tk\Tkinter.py”, line 1345,
in call
return self.func(*args)
File
“C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py”,
line 236, in button_press_event
FigureCanvasBase.button_press_event(self, x, y, num,
guiEvent=event)
File
“C:\Python24\Lib\site-packages\matplotlib\backend_bases.py”, line
1074, in button_press_event
self.callbacks.process(s, mouseevent)
File
“C:\Python24\Lib\site-packages\matplotlib\cbook.py”, line 152, in
process
func(*args, **kwargs)
File
“C:\Python24\Lib\site-packages\matplotlib\backend_bases.py”, line
983, in pick
self.figure.pick(mouseevent)
File “C:\Python24\Lib\site-packages\matplotlib\artist.py”,
line 226, in pick
for a in self.get_children(): a.pick(mouseevent)
File
“C:\Python24\Lib\site-packages\matplotlib\axes.py”, line 2306, in
pick
martist.Artist.pick(self,args[0])
File “C:\Python24\Lib\site-packages\matplotlib\artist.py”,
line 226, in pick
for a in self.get_children(): a.pick(mouseevent)
File
“C:\Python24\Lib\site-packages\matplotlib\artist.py”, line 220, in
pick
inside,prop = self.contains(mouseevent)
File “C:\Python24\Lib\site-packages\matplotlib\patches.py”,
line 385, in contains
x, y =
self.get_transform().inverted().transform_point(
File
“C:\Python24\Lib\site-packages\matplotlib\transforms.py”, line 1840,
in inverted
return CompositeGenericTransform(self._b.inverted(),
self._a.inverted())
File
“C:\Python24\Lib\site-packages\matplotlib\transforms.py”, line 1338,
in inverted
self._inverted = Affine2D(inv(mtx))
File
“C:\Python24\Lib\site-packages\numpy\linalg\linalg.py”, line 332, in
inv
return wrap(solve(a, identity(a.shape[0],
dtype=a.dtype)))
File
“C:\Python24\Lib\site-packages\numpy\linalg\linalg.py”, line 235, in
solve
raise LinAlgError, 'Singular matrix'
LinAlgError: Singular matrix
Stats:
MPL 0.98.1
Python 2.4.4
Numpy 1.1.0
I get the error on both Windows and Linux
Thanks,
-Ben