# Making Sense of the c parameter in the scatter() function of matplotlib.pyplot

I have been learning about the `c` parameter of the `scatter()` function in `matplotlib.pyplot`, and I realized it is quite flexible in the type of arguments it can work with.

The flexibility left me a bit confused about the overall workings of this parameter and my book does not explain the details, so I tried to make it make sense on my own, specifically, when fed a list of numbers and used with the `cmap` parameter.

I’ll list some of my attempted understandings. If you could tell me what parts are incorrect, please do that.

• The `c` parameter, when fed a list of integers, creates another list where each item represents a colour abstracted out of the colormap specified with the `cmap` parameter.

• The order of the colour specifying items in the newly created list is determined by the order of the integers in the list argument passed into the `c` parameter.

• The colour specifying items of the created list are assigned based on the order in which the data points are plotted.

• The selected list of colours is also influenced by the highest and lowest values in the list argument passed into `c`. For example, when using the Blues colormap, the data points associated with the highest and lowest numbers in that list will be assigned, respectively, the darkest and brightest variations of blue from the Blues colormap

I think you can expermentally verify by tinkering with some examples:

``````import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(20240214)
blues5 = mpl.colormaps["Blues"].resampled(5)
cmap4 = mpl.colors.ListedColormap(["darkorange", "gold", "lawngreen", "lightseagreen"])

N = 50
x = np.linspace(0, N)  # to keep things simple and see effects of ordering
y = np.random.rand(N)
area = (30 * np.random.rand(N))**2

plt.scatter(x, y, s=area, c=x, cmap=blues5, alpha=0.5)
plt.show()

plt.scatter(x, y, s=area, c=x, cmap=blues5, alpha=0.5)
plt.show()

plt.scatter(x, y, s=area, c=x, cmap=cmap4, alpha=0.5)
plt.show()

plt.scatter(x, y, s=area, c=y, cmap=cmap4, alpha=0.5)
plt.show()
``````