Jouni K. Seppänen wrote:

sidimok <sidimok@...287...> writes:

I'm using matplotlib to draw (from matplotlib.Patches import Circle)

filled

circles (disks) from a formatted data file, and would give each disk a

color relative to a variable, as done by the "scatter" function.

Here's one way to do it:

#!/usr/bin/env python

import matplotlib

from matplotlib.patches import Circle

import pylab

def myscatter(ax, colormap, x, y, radii, colors):

for x1,y1,r,c in zip(x, y, radii, colormap(colors)):

ax.add_patch(Circle((x1,y1), r, fc=c))

fig=pylab.figure()

ax=fig.add_subplot(111)

myscatter(ax, matplotlib.cm.jet,

pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),

pylab.rand(20))

ax.axis('equal')

pylab.show()

Hi!

It works just fine, however the colorbar I'm getting with the following

commands is very tiny.

norm = matplotlib.colors.Normalize(vmin=x[0], vmax=x[-1]) # just an example

cb = matplotlib.colorbar.ColorbarBase(ax, cmap=matplotlib.cm.jet, norm=norm)

Any idea?

Thanks guys.

## ···

--

View this message in context: http://www.nabble.com/Drawing-filled-circles-(discs)-tf4441651.html#a12776069

Sent from the matplotlib - users mailing list archive at Nabble.com.