It works great with patches of circles. Thank you.

Also, I want my circles to look round, so I use the command axis('equal'). Is there any way to make sure that the area I defined with xlim() and ylim() won't be cut off. I'd rather have one dimension expanded than the other one shrunk. Can I control that?

thanks,
guillaume

Le 07/09/2010 18:05, Benjamin Root a écrit :
2010/9/7 Guillaume Chérel <guillaume.c.che...@gmail.com <mailto:guillaume.c.che...@gmail.com>>

      Hello,

    I'm trying to draw circles with the scatter function. They are
    supposed
    to represent trees in the savannah. It is thus important that they are
    displayed with a proper size, that is, one which represents their
    actual
    size on the field. After quite some confusion, I've found out (I
    think)
    that the size argument one can specify with the scatter function is
    given as a disk's surface in pixels square (I think that's what means
    the "points^2" in the documentation and from my own tests)

    What I would like is to give a surface in unit^2, where "unit" is the
    unit of my data, and which you can read on the plot's axes ticks. For
    example, each tree has coordinates like x=3500, y=2210. (The unit here
    is centimeters but we don't really need to know this). Say I want to
    draw a tree which canopy is 200 cm wide. That makes a disk which
    radius
    is 100, or surface 100^2*PI. How can I draw this?

    Many thanks,
    Guillaume



Guillaume,

Using scatter is probably not the way to go about what you want. The circles for scatter are a fixed size and if you zoom in, they will not scale accordingly.

You probably want to create patches of Circles:

http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Circle
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg06786.html

Or even utilize a collection of Circles:

http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.CircleCollection

Note that for a CircleCollection, you would use 'offset' to indicate the center of each circle. After creating the collection, you would then use ax.add_collection() function to add that collection to the axes.

I hope that is helpful.
Ben Root
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to