int to matplotlib.colormaps value

Hello, i need you help!
I want to draw a plot with circles, which are coloured according to size. So
let's say we have a list=[1,3,5,7] that would give me four circles, first
very small, second bigger and so on.
Now i need a way to "convert" integers to color value which would match
matplotlib.cm.spectral
values.

I hope you understand what i want to do, something like: (
http://zoonek2.free.fr/UNIX/48_R/g208.png
http://zoonek2.free.fr/UNIX/48_R/g208.png )

I posted only the "important" bits of code:

list = [[2,5,1],[2,4,15],[13,2,1],[1,10,2]]
cmap = mpl.cm.spectral
norm = mpl.colors.Normalize(vmin=1, vmax=15)

listA = ([i for i in range(len(list))])
for a in range(len(list)):
listB = ([a for i in range(len(list[0]))])
area = ([count[a][i]*100 for i in range(len(list[a]))])
color = ([count[a][i]*100 for i in range(len(list[a]))])
plt.scatter(listA,listB,s=area, cmap=cmap, c=??what to put here???)

cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap, norm=norm,
orientation='vertical')

I hope someone could help me!

thank you very much
ales

ยทยทยท

--
View this message in context: http://www.nabble.com/int-to-matplotlib.colormaps-value-tp21026017p21026017.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

AlsCdz wrote:

Hello, i need you help!
I want to draw a plot with circles, which are coloured according to size. So
let's say we have a list=[1,3,5,7] that would give me four circles, first
very small, second bigger and so on. Now i need a way to "convert" integers to color value which would match
matplotlib.cm.spectral
values.

I hope you understand what i want to do, something like: (
http://zoonek2.free.fr/UNIX/48_R/g208.png
http://zoonek2.free.fr/UNIX/48_R/g208.png )

I posted only the "important" bits of code:

listData = [[2,5,1],[2,4,15],[13,2,1],[1,10,2]]
cmap = mpl.cm.spectral
norm = mpl.colors.Normalize(vmin=1, vmax=15)

listA = ([i for i in range(len(listData))])
for a in range(len(listData)):
listB = ([a for i in range(len(listData[0]))])
area = ([listData[a][i]*100 for i in range(len(listData[a]))])
color = ([listData[a][i]*100 for i in range(len(listData[a]))])
plt.scatter(listA,listB,s=area, cmap=cmap, c=??what to put here???)

cb1 = mpl.colorbar.ColorbarBase(ax1, cmap=cmap, norm=norm,
orientation='vertical')

I hope someone could help me!

thank you very much
ales

radius = np.arange(10)
area = np.pi*radius**2
x = np.random.rand(10)
y = np.random.rand(10)
cmap = plt.get_cmap('spectral')
plt.scatter(x, y, s=area, c=radius, cmap=cmap)
plt.colorbar()

I think the above illustrates what you need.

Eric