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).
I naively thought the two approaches should give the same result... Did I miss something in the way to use EllipseCollections?
Cheers,
ellipseColl.py (1.47 KB)
···
--
.~. Yannick COPIN (o:>* Doctus cum libro
/V\ Institut de physique nucleaire de Lyon (IN2P3 - France)
// \\ Tel: (33/0) 472 431 968 AIM: YnCopin ICQ: 236931013
/( )\ http://snovae.in2p3.fr/ycopin/
^`~'^