You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subsequent calls to plt.scatter with different categories raise ValueError #9700
Plotting with string categorical data fails, if the second call to plt.scatter contains categories not present in the first call to plt.scatter Code for reproduction
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "xxx/python3.6/site-packages/matplotlib/pyplot.py", line 3357, in scatter
edgecolors=edgecolors, data=data, **kwargs)
File "xxx/python3.6/site-packages/matplotlib/__init__.py", line 1710, in inner
return func(ax, *args, **kwargs)
File "xxx/python3.6/site-packages/matplotlib/axes/_axes.py", line 4010, in scatter
x = self.convert_xunits(x)
File "xxx/python3.6/site-packages/matplotlib/artist.py", line 191, in convert_xunits
return ax.xaxis.convert_units(x)
File "xxx/python3.6/site-packages/matplotlib/axis.py", line 1491, in convert_units
ret = self.converter.convert(x, self.units, self)
File "xxx/python3.6/site-packages/matplotlib/category.py", line 53, in convert
return vals.astype('float')
ValueError: could not convert string to float: 'c'
This is a duplicate of #9494, so I'll close this in lieu of the older Issue. Note PR #9705 seems to fix both. Thanks for the bug report; this one made it easier to see what was wrong with #9494 (for me)!
Activity
jklymak commentedon Nov 6, 2017
@dstansby aren't categoricals new? If this isn't a reversion, maybe this could be 2.2?
dstansby commentedon Nov 6, 2017
Yes, but this code definitely shouldn't error(!) which is why I've put it on 2.1.1
jklymak commentedon Nov 6, 2017
This is a duplicate of #9494, so I'll close this in lieu of the older Issue. Note PR #9705 seems to fix both. Thanks for the bug report; this one made it easier to see what was wrong with #9494 (for me)!