Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: dtype problem with BoundaryNorm #1258

Closed
WeatherGod opened this issue Sep 15, 2012 · 3 comments
Closed

Regression: dtype problem with BoundaryNorm #1258

WeatherGod opened this issue Sep 15, 2012 · 3 comments
Assignees
Milestone

Comments

@WeatherGod
Copy link
Member

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.

@WeatherGod
Copy link
Member Author

Finally got numpy 1.6.x rebuilt, and the BoundaryNorm problem did not exist then. Appears to be only for numpy v1.7+ and when the BoundaryNorm is set to interpolate.

@ghost ghost assigned efiring Sep 15, 2012
@efiring
Copy link
Member

efiring commented Sep 15, 2012

I can take care of it today.

efiring added a commit to efiring/matplotlib that referenced this issue Sep 15, 2012
@mdboom
Copy link
Member

mdboom commented Sep 18, 2012

Closing because #1260 is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants