Skip to content

Setting markeredgecolor raises a warning #6480

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

Closed
u55 opened this issue May 26, 2016 · 6 comments
Closed

Setting markeredgecolor raises a warning #6480

u55 opened this issue May 26, 2016 · 6 comments
Milestone

Comments

@u55
Copy link
Contributor

u55 commented May 26, 2016

Hi matplotlib developers,

Setting markeredgecolor to an RGB or RGBA numpy array now gives a warning in matplotlib 1.5.1. This was not a problem in version 1.4.3. Here is a minimal working example:

import numpy as np
import matplotlib.pyplot as plt

# color = [0.5, 0.5, 0.5, 1.0]  # Works without a warning
color = np.array([0.5, 0.5, 0.5, 1.0])  # Gives a warning

plt.figure()
plt.plot(np.arange(9), np.arange(9), marker='o', markeredgecolor=color)
plt.show()

In python 2.7, it gives this warning:

/usr/lib/python2.7/site-packages/matplotlib/lines.py:1082: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if self._markeredgecolor != ec:

And in python 3.5, it gives this different warning:

/usr/lib/python3.5/site-packages/matplotlib/lines.py:1082: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._markeredgecolor != ec:

Tested on Arch Linux.
--Thanks.

@u55
Copy link
Contributor Author

u55 commented May 26, 2016

@tacaswell Git is blaming you for this line.

@tacaswell
Copy link
Member

Those are both saying that we are comparing a string(Unicode) and an array.

I have a caught memory that we fixed this on master.

The change might have actually been updating Python or numpy underneath.

@jenshnielsen
Copy link
Member

@tacaswell We have fixed similar issues but I don't think we have fixed this one.

@u55
Copy link
Contributor Author

u55 commented May 26, 2016

Yes, there is a related open issue here #5806 and a closed issue here #5209.

@u55
Copy link
Contributor Author

u55 commented May 26, 2016

And issue #5209 was fixed with this commit 5e8fb62.

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Jun 15, 2016
@dstansby
Copy link
Member

I'm getting something slightly different on python 3.5:

>>> plt.plot(np.arange(9), np.arange(9), marker='o', markeredgecolor=color)
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/lines.py:1160: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.

Just running tests on a fix.

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.0.1 (next bug fix release) Dec 22, 2016
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

4 participants