Closed
Description
Bug report
Bug summary
Passing a particula gray intensity as a string seems to be broken in matplotlib 3.0, at least for the scatter() function.
This kind of argument format should (and was) possible according to documentation.
Code for reproduction
plt.scatter(np.arange(10), np.arange(10), c="0.5")
Actual outcome
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-99-426550bf20a7> in <module>()
----> 1 plt.scatter(np.arange(10), np.arange(10), c="0.5")
~/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, data, **kwargs)
2791 x=x, y=y, s=s, c=c, marker=marker, cmap=cmap, norm=norm,
2792 vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths,
-> 2793 verts=verts, edgecolors=edgecolors, data=data, **kwargs)
2794 sci(__ret)
2795 return __ret
~/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1783 "the Matplotlib list!)" % (label_namer, func.__name__),
1784 RuntimeWarning, stacklevel=2)
-> 1785 return func(ax, *args, **kwargs)
1786
1787 inner.__doc__ = _add_data_doc(inner.__doc__,
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4187 try: # First, does 'c' look suitable for value-mapping?
4188 c_array = np.asanyarray(c, dtype=float)
-> 4189 n_elem = c_array.shape[0]
4190 if c_array.shape in xy_shape:
4191 c = np.ma.ravel(c_array)
IndexError: tuple index out of range
Expected outcome
same as:
plt.scatter(np.arange(10), np.arange(10), c=(0.5,0.5,0.5))
Matplotlib version
- Operating system: Linux
- Matplotlib version: 3.0
- Matplotlib backend (
print(matplotlib.get_backend())
): notebook/inline - Python version: 3.6 (conda, default)
Metadata
Metadata
Assignees
Labels
For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.