Aleš Čadež wrote:
First of all, thanks for helping me. What you wrote is not exactly what i need. Let me show you an example:
Now here are different size circles (biggest grey is »size=8«, other two are »size=4«, and blue circles are size 2 and 1). I would like to color them according to colorbar (size=1 = blue, size=4 = green, size = 8 = red)
In your example there is random color to the circle size, i want the size to match the color.
I think my randomizing of the position is throwing you off. Here is a version that I think makes it more clear that the size (radius) is matching the color:
radius = np.arange(10)
area = np.pi*radius**2
x = radius
y = area
cmap = plt.get_cmap('spectral')
plt.scatter(x, y, s=area, c=radius, cmap=cmap)
plt.colorbar()
Eric