The color parameter for matplotlib's scatter is `c`, but `color` works too; prod. diff. results
matplotlib, python
Solution
This is not a bug, but IMO, a little ambiguity of `matplotlib`'s documents.
The color of markers, can be defined by either `c`, `color`, `edgecolor` and `facecolor`.
`c` is in the source code of `scatter()` in `axes.py`. That is equivalent to `facecolor`. When you use `c='r'`, `edgecolor` is left undefined and the default in `matplotlib.rcParams` come in to effect, which has a default value of `k` (black).
`color`, `edgecolor` and `facecolor` are passed to the `collection.Collection` object `scatter()` returns. As you will see in the source code `collections.py` (`set_color()`, `set_edgecolor()` and `set_facecolor()` methods), `set_color()` basically calls `set_edgecolor` and `set_facecolor`, therefore set the two properties the same values.
These I hope should explain the behavior that your described in the OP. In the case of `c='red'` the edge is black and the face color is red. In the case of `color=red`, both the face color and the edge color are red.
Problem
I accidentally used `color` instead of `c` as color parameter in matplotlib's scatter plot (`c` is listed in the documentation`) It worked, but the result is a different one: Edge colors are gone by default. Now, I am wondering if this is desired behavior and about how and why this works... ``` import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots(nrows=2, ncols=2, figsize=(10,10)) samples = np.random.randn(30,2) ax[0][0].scatter(samples[:,0], samples[:,1], color='red', label='color="red"') ax[1][0].scatter(samples[:,0], samples[:,1], c='red', label='c="red"') ax[0][1].scatter(samples[:,0], samples[:,1], edgecolor='white', c='red', label='c="red", edgecolor="white"') ax[1][1].scatter(samples[:,0], samples[:,1], edgecolor='0', c='1', label='color="1.0", edgecolor="0"') for row in ax: for col in row: col.legend(loc='upper left') plt.show() ```