|
From: Ethan A M. <sf...@us...> - 2017-11-08 23:40:12
|
On Wednesday, November 8, 2017 10:41:11 AM PST Achim Gratz wrote: > Ethan A Merritt via gnuplot-beta writes: > > > > I think the actual error is that > > set xrange [*:*] turns on autoscaling but does not erase the previous > > min/max. Since they were both negative numbers, "set log" complains. > > Yes, that sounds like a good explanation. > > > The code has a special check that handles the default axis range > > setting [-10:10]. Maybe that check should be extended to cover all > > cases of negative range limits? Not sure. But really I think the > > problem is that "set auto" and "set range [*:*] don't actually clear > > the previous limits. Unfortunately I suspect that the "refresh" > > command relies on that, so the best fix is not immediately clear. > > I don't think I can currently help with that. As a workaround it seems > that > > unset xrange; set autoscale x > > might do in our scripts, so I'm inclined to go with that for now. Here is a patch that I think will do the job. Since our SourceForge repository is currently in an undefined state (cvs is frozen, conversion to git has been done but may have to be redone if problems turn up), it may be a while before this change is visible in source downloaded from sf.net. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/set.c b/src/set.c index 2286ab362..c83d5905b 100644 --- a/src/set.c +++ b/src/set.c @@ -2790,10 +2790,17 @@ set_logscale() dummy = "x"; break; } - /* Avoid a warning message trigger by default axis range [-10:10] */ + /* Avoid a warning message triggered by default axis range [-10:10] */ if (axis_array[axis].set_min <= 0 && axis_array[axis].set_max > 0) axis_array[axis].set_min = 0.1; + /* Also forgive negative axis limits if we are currently autoscaling */ + if ((axis_array[axis].set_autoscale != AUTOSCALE_NONE) + && (axis_array[axis].set_min <= 0 || axis_array[axis].set_max <= 0)) { + axis_array[axis].set_min = 0.1; + axis_array[axis].set_max = 10.; + } + if (newbase == 10.) { sprintf(command, "set nonlinear %s via log10(%s) inv 10**%s", axis_name(axis), dummy, dummy); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |