## Re: [Plplot-general] Undistorted circles (was Re: box-and-whisker plots supported?)

 Re: [Plplot-general] Undistorted circles (was Re: box-and-whisker plots supported?) From: Alan W. Irwin - 2008-10-13 19:48:51 ```On 2008-10-13 18:22+0200 Robert Pollak wrote: > Hi Alan, > >> I assume you are referring to the kind of plot that is discussed in >> http://en.wikipedia.org/wiki/Box_plot. > > Yes, that's what I mean. > >> We currently have no higher-level API to support that. Of course, >> you could make your own function to do that using lower-level PLplot >> commands. > > I am now drawing such a box plot. I also want to mark outliers with > circles. Which aspect ratio do I need to draw undistorted circles? > (In other words: How to map world to device coordinates?) > > As I don't want to use "o" letters [...] > I tried the following, but it gives > me ellipses, e.g. when called in x12c.c: > > plcircle(PLFLT x, PLFLT y) > { > PLFLT vpxmin, vpxmax, vpymin, vpymax; > PLFLT ratio, rx, ry; > int i; > static PLFLT cx[31], cy[31]; > > /* get axis ratio */ > plgvpw(&vpxmin, &vpxmax, &vpymin, &vpymax); > ratio = (vpxmax -vpxmin) / (vpymax -vpymin); > > ry = 1.; > rx = ratio * ry; > for (i = 0; i <= 30; ++i) { > cx[i] = x + cos(i / 30. * 2. * M_PI) * rx; > cy[i] = y + sin(i / 30. * 2. * M_PI) * ry; > } > > pllsty(1); > plline(31, cx, cy); > } > > (I also don't understand the meaning of plgvpd(). What exactly are > "normalized device coordinates", e.g. when I use the wxwidgets device?) I suggest you review http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.0/viewport_window.html to get definitions of what you need to know and lots of other useful links to documentation of individual commands. However, it's pretty clear to me this documentation could use a rewrite. So if after digging through this documentation and comparing with what actually happens in the code, you have some improved wording to suggest, please let me know. A patch on doc/docbook/source/*.xml is the best form to communicate suggested changes to our documentation, but ascii is OK as well. To answer your general question about aspect ratio, plgvpw is not suitable for your needs because it returns world coordinates and not device coordinates. From the definition of "normalized device coordinates" in the above URL, it appears plgvpd is also not suitable for your needs. What you appear to need is something that returns real device units (whether they are in pixels, points, or mm doesn't matter since it is only the ratio the determines the aspect ratio). I therefore suggest you try plgspa or plgpage. However, I haven't tried those, and I think it is probably best that you survey all the modern device driver codes to be sure everything you need will be defined for whichever command (plgspa or plgpage) that you decide to use. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ```

 [Plplot-general] box-and-whisker plots supported? From: Robert Pollak - 2008-10-07 08:09:39 ```Hello, does PLplot support box-and-whisker plots? If yes, is there some example screenshot on the web? There is none at http://plplot.sourceforge.net/examples.php . Thank you, Robert Pollak ```
 Re: [Plplot-general] box-and-whisker plots supported? From: Alan W. Irwin - 2008-10-07 18:11:39 ```On 2008-10-07 10:09+0200 Robert Pollak wrote: > Hello, > does PLplot support box-and-whisker plots? If yes, is there some > example screenshot on the web? There is none at > http://plplot.sourceforge.net/examples.php . I assume you are referring to the kind of plot that is discussed in http://en.wikipedia.org/wiki/Box_plot. We currently have no higher-level API to support that. Of course, you could make your own function to do that using lower-level PLplot commands. If you donated such a function to PLplot with no external dependencies and with a corresponding example to show off that functionality, I believe there is a pretty good chance we would accept it (which means a fair amount of work on our part propagating the API and example to our different languages) since it appears from the above article to be a well-accepted plot style for quickly describing statistical distributions without the well-known drawbacks of histograms. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ```
 [Plplot-general] Undistorted circles (was Re: box-and-whisker plots supported?) From: Robert Pollak - 2008-10-13 16:24:30 ```Hi Alan, > I assume you are referring to the kind of plot that is discussed in > http://en.wikipedia.org/wiki/Box_plot. Yes, that's what I mean. > We currently have no higher-level API to support that. Of course, > you could make your own function to do that using lower-level PLplot > commands. I am now drawing such a box plot. I also want to mark outliers with circles. Which aspect ratio do I need to draw undistorted circles? (In other words: How to map world to device coordinates?) As I don't want to use "o" letters, I tried the following, but it gives me ellipses, e.g. when called in x12c.c: plcircle(PLFLT x, PLFLT y) { PLFLT vpxmin, vpxmax, vpymin, vpymax; PLFLT ratio, rx, ry; int i; static PLFLT cx[31], cy[31]; /* get axis ratio */ plgvpw(&vpxmin, &vpxmax, &vpymin, &vpymax); ratio = (vpxmax -vpxmin) / (vpymax -vpymin); ry = 1.; rx = ratio * ry; for (i = 0; i <= 30; ++i) { cx[i] = x + cos(i / 30. * 2. * M_PI) * rx; cy[i] = y + sin(i / 30. * 2. * M_PI) * ry; } pllsty(1); plline(31, cx, cy); } (I also don't understand the meaning of plgvpd(). What exactly are "normalized device coordinates", e.g. when I use the wxwidgets device?) -- Robert ```
 Re: [Plplot-general] Undistorted circles (was Re: box-and-whisker plots supported?) From: Alan W. Irwin - 2008-10-13 19:48:51 ```On 2008-10-13 18:22+0200 Robert Pollak wrote: > Hi Alan, > >> I assume you are referring to the kind of plot that is discussed in >> http://en.wikipedia.org/wiki/Box_plot. > > Yes, that's what I mean. > >> We currently have no higher-level API to support that. Of course, >> you could make your own function to do that using lower-level PLplot >> commands. > > I am now drawing such a box plot. I also want to mark outliers with > circles. Which aspect ratio do I need to draw undistorted circles? > (In other words: How to map world to device coordinates?) > > As I don't want to use "o" letters [...] > I tried the following, but it gives > me ellipses, e.g. when called in x12c.c: > > plcircle(PLFLT x, PLFLT y) > { > PLFLT vpxmin, vpxmax, vpymin, vpymax; > PLFLT ratio, rx, ry; > int i; > static PLFLT cx[31], cy[31]; > > /* get axis ratio */ > plgvpw(&vpxmin, &vpxmax, &vpymin, &vpymax); > ratio = (vpxmax -vpxmin) / (vpymax -vpymin); > > ry = 1.; > rx = ratio * ry; > for (i = 0; i <= 30; ++i) { > cx[i] = x + cos(i / 30. * 2. * M_PI) * rx; > cy[i] = y + sin(i / 30. * 2. * M_PI) * ry; > } > > pllsty(1); > plline(31, cx, cy); > } > > (I also don't understand the meaning of plgvpd(). What exactly are > "normalized device coordinates", e.g. when I use the wxwidgets device?) I suggest you review http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.0/viewport_window.html to get definitions of what you need to know and lots of other useful links to documentation of individual commands. However, it's pretty clear to me this documentation could use a rewrite. So if after digging through this documentation and comparing with what actually happens in the code, you have some improved wording to suggest, please let me know. A patch on doc/docbook/source/*.xml is the best form to communicate suggested changes to our documentation, but ascii is OK as well. To answer your general question about aspect ratio, plgvpw is not suitable for your needs because it returns world coordinates and not device coordinates. From the definition of "normalized device coordinates" in the above URL, it appears plgvpd is also not suitable for your needs. What you appear to need is something that returns real device units (whether they are in pixels, points, or mm doesn't matter since it is only the ratio the determines the aspect ratio). I therefore suggest you try plgspa or plgpage. However, I haven't tried those, and I think it is probably best that you survey all the modern device driver codes to be sure everything you need will be defined for whichever command (plgspa or plgpage) that you decide to use. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ```
 Re: [Plplot-general] Undistorted circles From: Robert Pollak - 2008-10-14 10:07:34 ```Alan W. Irwin wrote: >> I tried the following, but it gives >> me ellipses, e.g. when called in x12c.c: [...] >> /* get axis ratio */ >> plgvpw(&vpxmin, &vpxmax, &vpymin, &vpymax); >> ratio = (vpxmax -vpxmin) / (vpymax -vpymin); > > What you appear to need is something that returns real device units > (whether they are in pixels, points, or mm doesn't matter since it is > only the ratio the determines the aspect ratio). I therefore suggest > you try plgspa or plgpage. Thank you - the following works for me: /* get ratio s.t. ellipse appears as circle */ plgvpw(&vpxmin, &vpxmax, &vpymin, &vpymax); axisratio = (vpxmax -vpxmin) / (vpymax -vpymin); plgpage(&px, &py, &pxlen, &pylen, &pxoff, &pyoff); pageratio = pxlen * 1. / pylen; ratio = axisratio / pageratio; -- Robert ```