In the solution I gave, CirclePolygon has a resolution argument for
number of vertices to approximate the circle (default=20).  You could
increase that value to some more appropriate level:

import matplotlib
from matplotlib.patches import CirclePolygon
from matplotlib.collections import PolyCollection
import pylab 

fig=pylab.figure()
ax=fig.add_subplot(111) 

resolution = 50 # the number of vertices 
N = 20
x       = pylab.rand(N)
y       = pylab.rand(N)
radii   = 0.1*pylab.rand(N)
colors  = 100*pylab.rand(N)
verts   = []
for x1,y1,r in zip(x, y, radii):
    circle = CirclePolygon((x1,y1), r, resolution)
    verts.append(circle.get_verts())
    
p = PolyCollection(verts, cmap=matplotlib.cm.jet)
p.set_array(pylab.array(colors))
ax.add_patch(p)
pylab.colorbar(p)

ax.axis('equal')
pylab.show()



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
sidimok
Sent: Thursday, September 20, 2007 4:59 AM
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Drawing filled circles (discs)



Mika, David P (GE, Research) wrote:
> 
> How about this solution?  I'm a complete newbe, but this seems to do 
> the trick.  I didn't see a CircleCollection so I used CirclePolygon to

> generate vertices for a circle; these I grab and toss into a 
> PolyCollection.  Enjoy, Dave
> 
> 

Hi all!

Thank you very much indeed for the help, both solutions work like a
charm.
However Dave's one gives rough cirlces, approximated by polygones, which
is not very accurate for my buisness. May I ask how to create a
circleCollection as Jouni "The Expert" proposed?
You can find below one of my plottings rendered by Jouni's first trick.

http://www.nabble.com/file/p12793350/image.png
--
View this message in context:
http://www.nabble.com/Drawing-filled-circles-%28discs%29-tf4441651.html#
a12793350
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to