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 [...]
<aside> We actually have access to circular symbols (better than the "o" character) that are not subject to aspect ratio problems so I tried some experiments with those using the following python test script. ******** #!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # Like yellow lines better. plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0., 1., 0., 1.) # Just to show edges of viewport plbox("bc", 0., 0, "bc", 0., 0) x = [0.5] y = [0.5] ifplsym = False ifunicode = True for size in 1.0+arange(10): if ifplsym: plssym(0., size) plsym(x, y, 907) else: if ifunicode: plschr(0., 2.*size) plptex(0.5, 0.5, 1., 0., 0.5, "#[0x25ef]") else: plschr(0., size) plptex(0.5, 0.5, 1., 0., 0.5, "#(907)") # Terminate plplot plend() ******** To see results from that script you have to run it in the examples/python directory within the installed directory tree (not the source or build tree). The Hershey symbol version (using plsym [ifplsym == True]) actually gives a pretty good-looking circle, but you can probably make something that looks smoother if you use more points to represent it. Thus, I don't think the plsym version is quite suitable for your needs although it comes close so you should at least try it. The plptex version without unicode gives the same result as the plsym variant for drivers that use the Hershey fonts, but for drivers that use Unicode fonts (ifunicode == True), plptex has an obvious bug (repeated strings in the same position are not plotted in the same position) and the magnification done with plschr also magnifies the width of the line in a way that might make it unsuitable for your needs. In sum, plsym might give you what you need, but you will have to check, while plptex has a bug currently, and furthermore, even when that is fixed the magnification of the line width may be a concern. Anyhow, try some of these variants and see whether there are any of them that you like (assuming the positional bug gets fixed). </aside> > 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 __________________________ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general