Skip to content

Commit

Permalink
set logscale will reset improper range limits to [.1:10] if autoscali…
Browse files Browse the repository at this point in the history
…ng is active
  • Loading branch information
Ethan A Merritt committed Nov 19, 2017
1 parent a893db3 commit 742a456
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2017-11-08 Ethan A Merritt <merritt@u.washington.edu>

* src/set.c (set_logscale): If the axis is currently autoscaled and
the range limits still hold non-positive values from a previous state,
reset them to [0.1 : 10.].

2017-11-06 Ethan A Merritt <merritt@u.washington.edu>

* term/lua.trm term/lua/gnuplot-tikz.lua: Restore version information
Expand Down
9 changes: 8 additions & 1 deletion src/set.c
Expand Up @@ -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);
Expand Down

0 comments on commit 742a456

Please sign in to comment.