I have data:
values = np.array( [0,1,2,3,4,5] )
I want to plot values as pyplot.scatter with different sizes and colours. Also, I want to resize the dots so the smallest dots are well visible.
If I do:
sc = pyplot.scatter ( pos_x, pos_y, values )
pyplot.colorbar( sc )
then I get the proper values and colors, but the smallest dots are too small. Now if I do:
values_scaled = (values * 2 + 1)
sc = pyplot.scatter ( pos_x, pos_y, values_scaled )
pyplot.colorbar( sc )
then the dots have acceptable sizes (although a bit fake) but the colorbar legend starts at 1 and ends at 11, which I don’t want. I want to scale just sizes of the dots, but not the values assigned there. How to do that?
The matplotlib.pyplot.scatter functions takes an optional keyword argument
s, which is the “size in points^2. It is a scalar or an array of the same length as x and y”. So just pass yourvalues_scaledarray as the value of this argument and leave the colour data (the optionalckeyword argument) asvalues, i.e.: