Skip to content

Commit adaf987

Browse files
committed
Fix - exponential log axis labels
Range between 1 and 10 was produced incorrectly
1 parent df409ac commit adaf987

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

modules/gpad/TAxisPainter.mjs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,19 @@ const AxisPainterMethods = {
175175
/** @summary Provide label for exponential form */
176176
formatExp(base, order, value) {
177177
let res = '';
178+
const sbase = Math.abs(base - Math.E) < 0.001 ? 'e' : base.toString();
178179
if (value) {
179180
value = Math.round(value/Math.pow(base, order));
180-
if ((value !== 0) && (value !== 1)) res = value.toString() + (settings.Latex ? '#times' : 'x');
181-
}
182-
if (Math.abs(base - Math.E) < 0.001)
183-
res += 'e';
184-
else
185-
res += base.toString();
186-
if (settings.StripAxisLabels) {
187-
if (order === 0)
188-
return '1';
189-
else if (order === 1)
190-
return res;
181+
if (settings.StripAxisLabels) {
182+
if (order === 0)
183+
return value.toString();
184+
else if ((order === 1) && (value === 1))
185+
return sbase;
186+
}
187+
if (value !== 1)
188+
res = value.toString() + (settings.Latex ? '#times' : 'x');
191189
}
190+
res += sbase;
192191
if (settings.Latex > constants.Latex.Symbols)
193192
return res + `^{${order}}`;
194193
const superscript_symbols = {

0 commit comments

Comments
 (0)