Skip to content

Regression: dtype problem with BoundaryNorm #1258

Closed
@WeatherGod

Description

@WeatherGod

Just ran into a regression with v1.2.x branch and the latest numpy while using BoundaryNorm. A snippet from the relevant part of the traceback:

  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/axes.py", line 2082, in draw
    a.draw(renderer)
  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/collections.py", line 1429, in draw
    self.update_scalarmappable()
  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/collections.py", line 613, in update_scalarmappable
    self._facecolors = self.to_rgba(self._A, self._alpha)
  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/cm.py", line 240, in to_rgba
    x = self.norm(x)
  File "/home/ben/.local/lib/python2.7/site-packages/matplotlib/colors.py", line 1059, in __call__
    iret *= float(self.Ncmap - 1) / (self.N - 2)
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int16') with casting rule 'same_kind'

In the __call__ method of the BoundaryNorm class, the "iret" array is explicitly created with a dtype of int16. I think this means that BoundaryNorm will always fail with numpy 1.7+, so I would think that this is a release blocker.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions