On 2009-07-09 18:18-0400 Hezekiah M. Carty wrote: > This is a follow-up to the discussion of custom labeling from this thread: > > http://sourceforge.net/mailarchive/forum.php?thread_name=1240743487.4557.51.camel%40sony-sjs&forum_name=plplot-devel > > As a brief overview, Steve Schwartz asked about the possibility of > changing the format, layout and position of the plot axis multipliers > - the x10^n labels which may appear for axes with large values. > During the following email thread, I proposed a possible work-around > of allowing custom labeling functions in PLplot and volunteered to put > something together. > > The attached patch implements a new function, some related constants > and settings which allow a user to provide custom x, y and z axis > labeling. The changes made by the patch are: > > 1. A new option "o" can be added to any x, y or z option string for > plbox or plbox3 > 2. A new function plslabelfunc has been added to the public API to > allow a user to set a custom labeling function. The function receives > the axis being labeled and the floating point value where the label > will be placed, along with several other pieces of information, and > can return a custom string with the appropriate label text. > 3. New constants PL_X_AXIS, PL_Y_AXIS and PL_Z_AXIS are #define-d in > plplot.h (values 1, 2 and 3 respectively) to more easily identify axes > in a custom labeling function. > 4. New options 70, 71, 72 and 73 are added to the last argument of > plenv to support custom axis labeling. > 5. The C version of example 19 is updated to show an example of using > (2) and (3), with the first two plot pages now including longitude and > latitude labels in the form of "60 W" and "30 N" respectively. > > The first page of the updated example 19 output is attached to this email. > > I would like to ask for comments on the patch before I commit it, as > it touches several core PLplot areas. It should not, as far as I have > been able to test, affect any existing plotting code. If no custom > labels are requested or defined then the current, default PLplot > labeling behavior is used. > > If there are no major objections, I will update the PLplot > documentation and commit the changes. I can propagate the API and > example changes to the OCaml bindings as well. >
Hi Hez: Thanks for implementing this. I reviewed your explanation and took a quick look through your patches and didn't spot anything that overly concerned me. Also, I thought the new example 19 labelling looked pretty cool. If nobody else spots anything in the next few hours, I think you should feel free to commit your changes (as long as you feel equally free to update and/or revert some/all of those changes in case anybody's testing identifies problems or somebody comes up with a bright idea. :-) ) I am no API or binary compatibility expert, but one concern I have is the rigidity of the custom labelling function argument list. What happens if in the future one of our users has a truly exotic custom labelling routine that requires more data via the argument list of that function? Is there a standard way to future proof that API? I am thinking along the lines of the pltr_data argument of the call back routines (pltr0, pltr1, and pltr2) used in examples 9 and 16 for the plcont and plshades routines. Obviously, if you think it unlikely that future custom labelling functions will ever need more data from the PLplot core, then you shouldn't make any changes to future-proof that argument list. In any case, it is up to you whether you want to discuss this concern before or after you commit your present patch. 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 __________________________ ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel