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

ax.set_aspect triggers useless warnings #9976

Closed
gauthe opened this issue Dec 11, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@gauthe
Copy link

commented Dec 11, 2017

Hello,

Bug report

ax.set_aspect triggers a seemingly useless warning when its argument is a numpy.float64:

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([0],[0])
ax.set_aspect(float(1))    # this is fine
ax.set_aspect(np.float64(1))  # triggers warnings

Actual outcome

/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py:1292: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if aspect == 'normal':
/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py:1297: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  elif aspect in ('equal', 'auto'):

Expected outcome

I see little reason to treat differently float and numpy float and these warnings seem useless. Note that the actual result is fine.

The warnings appear for python 2.7 and matplotlib 2, I tested with

  • Debian official python, Python 2.7.13, matplotlib 2.0.0, backend = TkAgg
  • Anaconda python, Python 2.7.14, matplotlib 2.0.2, backend = WebAgg
@jklymak

This comment has been minimized.

Copy link
Contributor

commented Dec 11, 2017

This warning doesn't come up in Master, so I imagine this has been fixed... Thanks for the report and feel free to re-open if you think there is a current bug.

@jklymak jklymak closed this Dec 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.