Yannick Copin wrote:
> Hi,
> 
> I would like to plot lots of error ellipses on my plot. I thought I 
> could use an EllipseCollection to do so, but I didn't manage to get the 
> ellipse sizes, expressed in data units, right (see test script attached).
> 
> When using a plain list of Ellipse's, everything looks fine:
> 
> ells = [ P.matplotlib.patches.Ellipse(xy=xyi,
>                                       width=wi, height=hi,
>                                       angle=ai,
>                                       edgecolor='b',
>                                       facecolor='b',
>                                       alpha=0.3)
>          for xyi,wi,hi,ai in zip(xy,w,h,a)]
> for ell in ells:
>     ax.add_artist(ell)
> 
> But when using EllipseCollection (as explained in 
> http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html),
>  
> 
> 
> coll = P.matplotlib.collections.EllipseCollection(widths=w,
>                                                   heights=h,
>                                                   angles=a,
>                                                   units='x',
>                                                   offsets=xy,
>                                                   transOffset=ax.transData,
>                                                   edgecolor='r',
>                                                   facecolor='r',
>                                                   alpha=0.3)
> ax.add_collection(coll)
> 
> the size of the ellipses (expressed in data units) appears incorrect, 
> and depends furthermore of the aspect ratio of the figure (try pan/zoom 
> or resize the interactive window).

Maybe I am misunderstanding, but the EllipseCollection in the example is 
panning and zooming as I expect.  The shapes and orientations are 
staying the same while the scale expands and contracts with the x-axis.

The problem is that the option you are looking for does not exist yet. 
   I am not sure yet whether what you need is identical to an option I 
added to quiver (from which I partially derived EllipseCollection).  I 
suspect it is.

Do you want width to scale with x and height to scale with y?  And the 
angle to scale such that a 45-degree angle always corresponds to equal 
increments in x and in y, all in data units?

> 
> I naively thought the two approaches should give the same result... Did 
> I miss something in the way to use EllipseCollections?

EllipseCollection is derived more from quiver than from Ellipse.

Eric

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to