Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug report
Affects: commit7b5ff33 (master, 23 Aug 2018)
An attempt to plot a single point at coords (2,3) with RGB color (120,130,140) throws an error message remarking about argument shapes mismatching. Message should be about RGB values outside range 0 to 1.
Code for reproduction
ax.scatter(np.array([2]),np.array([3]),c=np.array([[120,130,140]]))
ValueError: c of shape (1, 3) not acceptable as a color sequence for x with size 1, y with size 1
This is ok:
ax.scatter(np.array([2]),np.array([3]),c=np.array([[120,130,140]])/255.0 )
Actual outcome
See above.
Expected outcome
Suggestion: error message could be about RGB values outside of 0 to 1 range.
Trace
File"/home/d/code/matplotlib/lib/matplotlib/axes/_axes.py",line4223,inscatter .format(nc=n_elem,xs=x.size,ys=y.size)ValueError:'c'argumenthas3elements,whichisnotacceptableforusewith'x'withsize1,'y'withsize1.
python 2 gives slightly different trace:
/home/d/.conda/envs/py2_dp/lib/python2.7/site-packages/matplotlib-2.2.2-py2.7-linux-x86_64.egg/matplotlib/axes/_axes.pycinscatter(self,x,y,s,c,marker,cmap,norm,vmin,vmax,alpha,linewidths,verts,edgecolors,**kwargs)4277raiseValueError("c of shape {} not acceptable as a color "4278"sequence for x with size {}, y with size {}"->4279 .format(c.shape,x.size,y.size))4280else:4281colors=None# use cmap, norm after collection is createdValueError:cofshape (1,3)notacceptableasacolorsequenceforxwithsize1,ywithsize1
Matplotlib version
- Operating system: Ubuntu 16.04
- Matplotlib version: commit7b5ff33 (master, 23 Aug 2018)
- Matplotlib backend (
print(matplotlib.get_backend())
): <object object at 0x7f8885d87190> - Python version: 3.5.5
- Jupyter version (if applicable): none
- Other libraries: numpy
How I installed matplotlib:
- Create new conda env with python 3.5.5
- git clone matplotlib master
- pip install -e /path/to/cloned-repo