Setting markeredgecolor raises a warning #6480

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

Comments

Projects
None yet
4 participants
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.

Contributor

u55 commented May 26, 2016

@tacaswell Git is blaming you for this line.

Owner

tacaswell commented May 26, 2016

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.

Owner

jenshnielsen commented May 26, 2016

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

Contributor

u55 commented May 26, 2016

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

Contributor

u55 commented May 26, 2016

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

Contributor

dstansby commented Dec 21, 2016

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.

QuLogic closed this in #7657 Dec 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment