Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3b6ff9

Browse files
committed
Fix symlog ticking issues by adjusting power-of-10 linthresh
1 parent 58b3a9c commit e3b6ff9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎proplot/scale.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,20 @@ def _parse_logscale_args(*keys, **kwargs):
5050
}
5151
value = _not_none(**opts) # issues warning if multiple values passed
5252

53-
# Apply defaults
53+
# Apply defaults and adjust
5454
# NOTE: If linthresh is *exactly* on a power of the base, can end
5555
# up with additional log-locator step inside the threshold, e.g. major
5656
# ticks on -10, -1, -0.1, 0.1, 1, 10 for linthresh of 1. Adding slight
5757
# offset to *desired* linthresh prevents this.
58-
if key == 'linthresh' and value is None:
59-
value = 1 + 1e-10
60-
if key == 'subs' and value is None:
61-
value = np.arange(1, 10)
58+
if key == 'subs':
59+
if value is None:
60+
value = np.arange(1, 10)
61+
if key == 'linthresh':
62+
if value is None:
63+
value = 1
64+
power = np.log10(value)
65+
if power % 1 == 0: # exact power of 10
66+
value = value + 10 ** (power - 10)
6267
if value is not None: # dummy axis_name is 'x'
6368
kwargs[key + kwsuffix] = value
6469

0 commit comments

Comments
 (0)