8000 Quiver does not _init with animated=True and quiverkey attached · Issue #2616 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Quiver does not _init with animated=True and quiverkey attached #2616
Closed
@OceanWolf

Description

@OceanWolf

Creating a quiver object with animated=True and adding this to a quiver key, this fails

self.plot = self.ax.quiver(x, y, U, V, scale=10, animated=True)
self.ax.quiverkey(self.plot, 0.9, 0.95, 1, '1 m/s')

with

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1437, in __call__
    return self.func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 236, in resize
    self.show()
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 239, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 421, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 898, in draw
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 1997, in draw
    a.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/quiver.py", line 304, in draw
    self._init()
  File "/usr/lib/pymodules/python2.7/matplotlib/quiver.py", line 272, in _init
    np.zeros((1,)))
  File "/usr/lib/pymodules/python2.7/matplotlib/quiver.py", line 571, in _make_verts
    length = a * (widthu_per_lenu / (self.scale * self.width))
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'

Obviously adding the optional width attribute to the quiver call, works as a dodgy workaround, but not the best as it neglects other code in the _init method. Note, using matplotlib version 1.1.1rc2

As a side issue, why can one not call quiverkey from the figure object? One can add both a colorbar and a legend from the figure object, so quiverkey seems the odd one out.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0