Re: [Plplot-devel] Custom axis labeling is now in PLplot trunk

2009-08-05 Thread Hezekiah M. Carty
On Tue, Aug 4, 2009 at 12:26 PM, Alan W. Irwinir...@beluga.phys.uvic.ca wrote:
 On 2009-08-04 08:48-0700 Alan W. Irwin wrote:

 On 2009-08-03 22:21-0400 Hezekiah M. Carty wrote:

 Commit 10206 adds custom axis label support (the function
 plslabelfunc, C only for now) to PLplot trunk.  Commit 10207 updates
 example 19 (also C only for now) to use plslabelfunc for specialized
 longitude and latitude axis labels.

 Hi Hez:

 ctest shows an example 19 segfault now.

 I have just now tried revision 10205, and the segfault is gone and valgrind
 produces absolutely clean results for example 19 with -dev psc so the issue
 must be something you introduced in 10206 or 10207.

Alan,

Thank you for the tests and detailed feedback.  I could not reproduce
the issue on my existing build tree, but a clean build tree does show
the segfault.

Commit 10215 fixes the problem on my system, with a slight change to
the custom label callback signature.  It now takes a string length
argument, and the callback is expected to set the label text directly.
 Example 19 has been updated to reflect this change.

Please let me know if this fixes the issue.  Example 19 is now
valgrind-clean on my system (64bit Ubuntu 9.04).

My wife defended her PhD dissertation yesterday and we are moving in
the next few days.  I apologize for my relatively slow responses
recently.  Once we are moved and somewhat settled in (~1 week from
now, hopefully) I should be able to keep up with PLplot more
effectively!

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Custom axis labeling is now in PLplot trunk

2009-08-05 Thread Alan W. Irwin
On 2009-08-05 11:25-0400 Hezekiah M. Carty wrote:

 Commit 10215 fixes the problem [segfault for example 19] on my system, with a 
 slight change to
 the custom label callback signature.  It now takes a string length
 argument, and the callback is expected to set the label text directly.
 Example 19 has been updated to reflect this change.

 Please let me know if this fixes the issue.  Example 19 is now
 valgrind-clean on my system (64bit Ubuntu 9.04).

Hi Hez:

Yep, all is well now on my platform; example 19 no longer has a segfault and
it is valgrind clean as well.  Thanks for your quick response to the
problem I found.

Once you have some more time for PLplot would you be willing to add some
additional documentation of plslabelfunc? At minimum, the meaning of the
callback function label_func arguments should be documented.  You already
document the char* argument, but what about the PLINT, PLFLT arguments
before it, and the PLINT, void * arguments after it? Probably, the best way
to do such callback documentation is to move your documentation of the char*
argument to some full documentation of at least one particular example of
the label_func callback similar to how the plshades documentation refers to
the full pltr0, pltr1, and pltr2 documentation for details about its pltr
callback function, see
http://plplot.sourceforge.net/docbook-manual/plplot-html-5.9.4/plshades.html.

plshades documentation also refers to a chapter of general documentation
concerning use of plshade(s), but it is up to you whether such a chapter
would be useful in the plslabelfunc case or not.  If you decide to go ahead
with such a chapter (which could be as small as a few paragraphs) but cannot
figure out how to stick it into the right place in the overall
documentation, let me have the xml for the chapter, and I can do the rest of
it.


 My wife defended her PhD dissertation yesterday and we are moving in
 the next few days.  I apologize for my relatively slow responses
 recently.  Once we are moved and somewhat settled in (~1 week from
 now, hopefully) I should be able to keep up with PLplot more
 effectively!

No problem.  PLplot developers are volunteers who often drop out for periods
of time as other things take higher priority. You cannot go wrong if you do
as much as you can with PLplot in your spare time (when that is available)
on PLplot projects which are fun for you or which satisfy some basic
plotting need that you feel is important.  Of course, when you do make a
change it is good to have a little spare time in hand for quick response
(like you did above) in case there turns out to be some problem with your
change.

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
__

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] Custom axis labeling is now in PLplot trunk

2009-08-03 Thread Hezekiah M. Carty
Commit 10206 adds custom axis label support (the function
plslabelfunc, C only for now) to PLplot trunk.  Commit 10207 updates
example 19 (also C only for now) to use plslabelfunc for specialized
longitude and latitude axis labels.  The function is simplified from
what I originally proposed, based on comments from others on the list:

void plslabelfunc(void (*label_func)(PLINT, PLFLT, const char *,
PLPointer), PLPointer label_data);

where label_func arguments would be:

void label_func(PLINT axis, PLFLT value, const char *label, PLPointer data);

label_func should create a string with the desired label text (based
on the value in the axis argument) and set label to point to that
string.  label_data from plslabelfunc is passed to each call of
label_func as data.  axis could be changed to take an enumeration
of some sort rather than #define'd constants if that would be
considered better.  For now, I have added PL_X_AXIS, PL_Y_AXIS and
PL_Z_AXIS to plplot.h with appropriate values.  Named integer
constants seem to be used in PLplot over enums, so I was going largely
by precedent in this choice.

I also added, per Steve's request, support for custom placement of the
(x10^n) axis scaling text.  I have not committed an example to svn
to demonstrate this, but I do have a patch for example 1 which
demonstrates this (see the attached patch).  If no custom labeling
function is provided, one can provide a struct with information on how
to position the axis multiplier text.  If others think this is worth
including this update to example 1 I will commit it.  It is a very
subtle visual change, so I didn't want to be overly invasive with
these updates.

While I am reasonably happy with the axis labeling implementation, I
am less happy with the implementation of the customized (x10^n)
multiplier positioning - it feels inelegant and inflexible to me.
Improvements, or suggestions for improvements, are welcome.

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science
diff --git a/examples/c/x01c.c b/examples/c/x01c.c
index f9b30d1..8e0dc0c 100644
--- a/examples/c/x01c.c
+++ b/examples/c/x01c.c
@@ -217,6 +217,7 @@ plot1(int do_test)
 {
   int i;
 PLFLT xmin, xmax, ymin, ymax;
+PLLabelDefaults label_opt;
 
 for (i = 0; i  60; i++) {
 	x[i] = xoff + xscale * (i + 1) / 60.0;
@@ -233,13 +234,20 @@ plot1(int do_test)
 	ys[i] = y[i * 10 + 3];
 }
 
+label_opt.exp_label_disp = 0.15;
+label_opt.exp_label_pos = -0.07;
+label_opt.exp_label_just = 1.0;
+
 /* Set up the viewport and window using PLENV. The range in X is
  * 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are
  * scaled separately (just = 0), and we just draw a labelled
  * box (axis = 0).
+ * Also enable custom placement of the exponential label.
  */
 plcol0(1);
+plslabelfunc(NULL, label_opt);
 plenv(xmin, xmax, ymin, ymax, 0, 0);
+plslabelfunc(NULL, NULL);
 plcol0(2);
 pllab((x), (y), #frPLplot Example 1 - y=x#u2);
 
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel