|
From: Aapo L. <aap...@gm...> - 2006-07-10 17:04:25
|
Hello everyone!
I found a bug in Gnuplot CVS logarithmic axis minitics in certain
user-controlled minitic settings when I was plotting a logarithmic graph
with rather long range today. The following short script highlights the
problem:
set logscale y
set ytics 10
set mytics 10
plot [0:1e3] [1:1e10] x**3
pause -1
set ytics 100
set mytics 10
plot [0:1e3] [1:1e10] x**3
pause -1
The first plot has the minitics on the logarithmic y-axis as it should;
but the second plot with ytics having a longer step doesn't show any
minitics at all. I think the 10 minitics should be there as ordered,
no? So, I hurried through the Gnuplot CVS source and found a solution
(patch attached). However, I'm not sure whether or not there are any
problems that I might have overlooked, so could someone who understands
the axis system check the problem and the patch, please? Particularly,
I'm not sure why there was a (step <= 1.5) condition - I needed to
remove it to allow larger ytics steps than 1.5 (the example has step =
2.0). As a bonus, the patch fixes a typo in comment, "but" should
probably be "bug". :-)
Best Regards, and thanks for the good plotting program
Aapo Lankinen
--- src/axis.c 2006-07-10 19:32:44.000000000 +0300
+++ src/axis.c 2006-07-10 19:35:19.000000000 +0300
@@ -976,9 +976,9 @@
minitics = 0; /* not much else we can do */
else if (axis_array[axis].log) {
/* Sep 2005 - This case has been commented out since v3.7 */
- /* but in fact it seems correct, and fixes but #1223149 */
- ministart = ministep = step / minifreq * axis_array[axis].base;
- miniend = step * axis_array[axis].base;
+ /* but in fact it seems correct, and fixes bug #1223149 */
+ ministart = ministep = AXIS_UNDO_LOG(axis,step) / minifreq;
+ miniend = AXIS_UNDO_LOG(axis,step);
} else {
ministart = ministep = step / minifreq;
miniend = step;
@@ -1137,7 +1137,7 @@
internal + mplace);
else
mtic = internal
- + (axis_array[axis].log && step <= 1.5
+ + (axis_array[axis].log
? AXIS_DO_LOG(axis,mplace)
: mplace);
if (inrange(mtic, internal_min, internal_max)
|