|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Drawing Error EllipsesHi,
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? -- Eero Nevalainen System Architect Indagon Ltd. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesOn Wed, Oct 28, 2009 at 9:06 AM, Eero Nevalainen
<eero.nevalainen@...> 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 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesOn Wed, Oct 28, 2009 at 9:55 AM, Tinne De Laet
<tinne.delaet@...> wrote: > On Wed, Oct 28, 2009 at 9:06 AM, Eero Nevalainen > <eero.nevalainen@...> 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, I still discoverd some problems with my plotEllipse function: 1) the angle in the ellipsePlot expects and angle in DEGREES and not in radians apparently 2) forgot a factor 2 for the width and height (it's the entire width not the `radius`) 3) removed the show() command which sometimes behaves strange (having to close the figure before continuing plotting) So a new trial: def plotEllipse(pos,P,edge,face): U, s , Vh = svd(P) orient = math.atan2(U[1,0],U[0,0])*180/pi ellipsePlot = Ellipse(xy=pos, width=2.0*math.sqrt(s[0]), height=2.0*math.sqrt(s[1]), angle=orient,facecolor=face, edgecolor=edge) ax = gca() ax.add_patch(ellipsePlot); return ellipsePlot; Good luck, Tinne ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesThanks, and yes it looks better now :)
Tinne De Laet wrote: > I still discoverd some problems with my plotEllipse function: > 1) the angle in the ellipsePlot expects and angle in DEGREES and not > in radians apparently so it seems > 2) forgot a factor 2 for the width and height (it's the entire width > not the `radius`) I'd even say that this is a documentation bug in the Ellipse class. Too bad that they are multiplying by 0.5 inside their code :P -- Eero Nevalainen System Architect Indagon Ltd. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesEero Nevalainen wrote:
>> 2) forgot a factor 2 for the width and height (it's the entire width >> not the `radius`) >> > > I'd even say that this is a documentation bug in the Ellipse class. > Too bad that they are multiplying by 0.5 inside their code :P > Well, it's not a good idea to change the existing behavior now, but we can improve the documentation. What would you suggest? Would you prefer to see the word "diameter" in there explicitly somehow? It currently says: *width* length of horizontal axis *height* length of vertical axis Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesMichael Droettboom wrote:
> Eero Nevalainen wrote: >>> 2) forgot a factor 2 for the width and height (it's the entire width >>> not the `radius`) >>> >> I'd even say that this is a documentation bug in the Ellipse class. >> Too bad that they are multiplying by 0.5 inside their code :P >> > Well, it's not a good idea to change the existing behavior now, but we > can improve the documentation. What would you suggest? Would you > prefer to see the word "diameter" in there explicitly somehow? > > It currently says: > > *width* > length of horizontal axis > > *height* > length of vertical axis OK, here are some proposals: 1. length (2a) of horizontal axis length (2b) of vertical axis 2. diameter of horizontal axis diameter of vertical axis 3. length (diameter) of horizontal axis length (diameter) of vertical axis 4. length (2r) of horizontal axis length (2r) of vertical axis I like number one the most. -- Eero Nevalainen System Architect Indagon Ltd. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesWe've had several users come to the same (incorrect) conclusion so I'd have to say it's not a rare occurrence for those comments to be misunderstood. Perhaps adding "total" in front of length would help.
width- The total width of the ellipse > -----Original Message----- > From: Michael Droettboom [mailto:mdroe@...] > Sent: Wednesday, October 28, 2009 6:59 AM > To: Eero Nevalainen > Cc: matplotlib-users@... > Subject: Re: [Matplotlib-users] Drawing Error Ellipses > > Eero Nevalainen wrote: > >> 2) forgot a factor 2 for the width and height (it's the entire width > >> not the `radius`) > >> > > > > I'd even say that this is a documentation bug in the Ellipse class. > > Too bad that they are multiplying by 0.5 inside their code :P > > > Well, it's not a good idea to change the existing behavior now, but we > can improve the documentation. What would you suggest? Would you > prefer to see the word "diameter" in there explicitly somehow? > > It currently says: > > *width* > length of horizontal axis > > *height* > length of vertical axis > > Mike > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > ----------------------------------------------------------------------- > ------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
|
Re: Drawing Error EllipsesOn Wed, Oct 28, 2009 at 2:59 PM, Michael Droettboom <mdroe@...> wrote:
> Eero Nevalainen wrote: >>> 2) forgot a factor 2 for the width and height (it's the entire width >>> not the `radius`) >>> >> >> I'd even say that this is a documentation bug in the Ellipse class. >> Too bad that they are multiplying by 0.5 inside their code :P >> > Well, it's not a good idea to change the existing behavior now, but we > can improve the documentation. What would you suggest? Would you > prefer to see the word "diameter" in there explicitly somehow? > > It currently says: > > *width* > length of horizontal axis > > *height* > length of vertical axis > for the ellipses parameters can be improved. I however I don't believe it is a very good idea to use non standard units like degrees .... You force your users to convert their output of mathematical calculations to non-standard units before being able to plot. I also think that the usage of radius in the circle patch is not consistent with using the length of the full horizontal axis of the ellipse patch .... Tinne ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
| Free embeddable forum powered by Nabble | Forum Help |