|
From: Hans-Bernhard B. <HBB...@t-...> - 2010-11-05 22:36:06
|
On 05.11.2010 19:50, Ethan Merritt wrote: > I have encountered a problem while trying to predict or adjust axis scaling > in advance of actually issuing a plot command. The problem is that the > "set log" command sets the field AXIS.base, but the corresponding field > log_base is not initialized until a subsequent plot command invokes the > macro AXIS_INIT2D. Instead it is set to zero. It's _initialized_ to zero. It's set to zero only by the AXIS_INIT*D macros themselves, and that only if the axis is not logscaled. And it would appear to happen so late to allow implementing the 'islog_override' argument for AXIS_INIT3D. > Why would you ever want to have AXIS.log_base out of sync with AXIS.base? Well, that "you" might be me, I guess. I started axis.[ch] as a renovation project. That was finished by the release of gnuplot 3.8e, exactly 10 years ago this week. But most of that code I just refactored from lots of individual arrays (min_array[], log_base_array[], ...) into a single array of structs, so the code you're looking at is actually even older than that. OTOH, none of the code using log_base is or ever was meant to be used before AXIS_INIT* anyway, so it's not really out of sync. > Can anyone think of a reason why it isn't correct to always set log_base > at the same time the base itself is set? I.e., on every call to "set log". One part of the problem is: what value do you set it to when the axis is _not_ logarithmic? In theory, it would have to be negative infinity --- but that can't be done reliably. Zero is the next best thing. > And everywhere that it is set to zero should be removed, since zero is > never a legal value. No, it shouldn't. Precisely because it's never legal for a log axis, it's just about the perfect signal for "this axis is not logarithmic". And since axes are non-logarithmic by default, that's the right initial value. |