Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
Bug summary
Scatterdocs say that in order to provide a single RGB/RGBA color for all scatter elements, it is required to pass a 2D array with a single row forc
argument input:
If you want to specify the same RGB or RGBA value for all points, use a 2-D array with a single row. Otherwise, value- matching will have precedence in case of a size matching with x and y.
When x/y shape is 3 and RGB is passed as a 2D array with a single row (e.g.c=[[1, 0.5, 0.05]]
), or when x/y shape is 4 and RGBA is passed as a 2D array with a single row, the plot elements have several different colors (taken from the default colormap?) while all should have the same color. The problem occurs for bothplt.scatter
andax.scatter
calls, and also ifc
input is provided as a numpy array of shape (1,3) for RGB or (1,4) for RGBA instead of a nested list.
Code for reproduction
importmatplotlib.pyplotaspltplt.scatter(range(3),range(3),c=[[1,0.5,0.05]])#alternatively, for RGBA scenarioplt.scatter(range(4),range(4),c=[[1,0.5,0.05,1]])
Expected outcome
All points have the same color: RGB (1, 0.5, 0.05).
Matplotlib version
- Operating system: Linux
- Matplotlib version: 3.2.1
- Matplotlib backend (
print(matplotlib.get_backend())
): agg - Python version: 3.7.3
Matplotlib installed through pip