From: Hezekiah M. C. <hez...@us...> - 2009-07-09 22:18:27
|
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. Hez -- Hezekiah M. Carty Graduate Research Assistant University of Maryland Department of Atmospheric and Oceanic Science |