From: Tinne De L. <tin...@me...> - 2009-10-28 08:56:28
|
On Wed, Oct 28, 2009 at 9:06 AM, Eero Nevalainen <eer...@in...> wrote: > Hi, > > I need to draw error ellipses on a scatterplot. I'm guessing someone has > done this before. > > I've found some examples, such as this one > http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_rotated.html > > That led to the artist tutorial, and... ARGH! INFORMATION OVERFLOW! > > Can someone explain to me, why I suddenly have to know so much about > matplotlib's internals to get an ellipse drawn? Hi, I just made a function to draw uncertainty ellipses defined by a covariance matrix P: def plotEllipse(pos,P,edge,face): U, s , Vh = svd(P) orient = math.atan2(U[1,0],U[0,0]) ellipsePlot = Ellipse(xy=pos, width=math.sqrt(s[0]), height=math.sqrt(s[1]), angle=orient,facecolor=face, edgecolor=edge) ax = gca() ax.add_patch(ellipsePlot); show() return ellipsePlot To use it: ellipsePlot=plotEllipse([x,y],P,'black','0.3') Hope this helps, Tinne |