matplotlib: Tkagg - resizing window

Dear All,

I would like to draw (3,3) subplots and afterwards resize the whole widget.
Plotting works like a charm, but when resizing the widget these errors are
reported:
(Version 0.87.2, Tkagg,suse 10.0)

When resizing, or even just clicking on the button for the widget to rearrange
the plot on the fly, I get the messages below...

cheers Juergen
PS I am currently using the figsize option to figure as workaround..

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File
"/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 148, in resize
    self.show()
  File
"/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 151, in draw
    FigureCanvasAgg.draw(self)
  File
"/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 398, in draw
    self.figure.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py", line
529, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py", line 1455,
in draw
    a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/collections.py",
line 325, in draw
    if self._edgecolors == 'None':
  File "/usr/local/lib/python2.4/site-packages/numarray/generic.py", line 537,
in __nonzero__
    raise RuntimeError("An array doesn't make sense as a truth value. Use
any(a) or all(a).")
RuntimeError: An array doesn't make sense as a truth value. Use any(a) or
all(a).

Juergen,

I think the patch below will fix the bug; I will apply it to svn unless a problem crops up.

Eric

Index: collections.py

···

===================================================================
--- collections.py (revision 2231)
+++ collections.py (working copy)
@@ -170,7 +170,7 @@
          else:
              Artist.set_alpha(self, alpha)
              self._facecolors = [(r,g,b,alpha) for r,g,b,a in self._facecolors]
- if self._edgecolors != 'None':
+ if self._edgecolors is not 'None':
                  self._edgecolors = [(r,g,b,alpha) for r,g,b,a in self._edgecolors]

      def update_scalarmappable(self):
@@ -253,7 +253,7 @@
          self._transform.freeze()
          self._transOffset.freeze()
          self.update_scalarmappable()
- if self._edgecolors == 'None':
+ if self._edgecolors is 'None':
              self._edgecolors = self._facecolors
          renderer.draw_poly_collection(
              self._verts, self._transform, self.clipbox,
@@ -322,7 +322,7 @@
          self.update_scalarmappable()
          scales = sqrt(self._sizes*self._dpi.get()/72.0)

- if self._edgecolors == 'None':
+ if self._edgecolors is 'None':
              self._edgecolors = self._facecolors

          renderer.draw_regpoly_collection(

Juergen Haas wrote:

Dear All,

I would like to draw (3,3) subplots and afterwards resize the whole widget.
Plotting works like a charm, but when resizing the widget these errors are reported:
(Version 0.87.2, Tkagg,suse 10.0)

When resizing, or even just clicking on the button for the widget to rearrange the plot on the fly, I get the messages below...

cheers Juergen
PS I am currently using the figsize option to figure as workaround..

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py", line 148, in resize
    self.show()
  File "/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py", line 151, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 398, in draw
    self.figure.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/figure.py", line 529, in draw
    for a in self.axes: a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py", line 1455, in draw
    a.draw(renderer)
  File "/usr/local/lib/python2.4/site-packages/matplotlib/collections.py", line 325, in draw
    if self._edgecolors == 'None':
  File "/usr/local/lib/python2.4/site-packages/numarray/generic.py", line 537, in __nonzero__
    raise RuntimeError("An array doesn't make sense as a truth value. Use any(a) or all(a).")
RuntimeError: An array doesn't make sense as a truth value. Use any(a) or all(a).

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users