|
6 | 6 | LogTransform, InvertedLogTransform, |
7 | 7 | SymmetricalLogTransform) |
8 | 8 | import matplotlib.scale as mscale |
| 9 | +from matplotlib.ticker import AsinhLocator, LogFormatterSciNotation |
9 | 10 | from matplotlib.testing.decorators import check_figures_equal, image_comparison |
10 | 11 |
|
11 | 12 | import numpy as np |
@@ -261,6 +262,28 @@ def test_base_init(self): |
261 | 262 | assert s7._base == 7 |
262 | 263 | assert s7._subs == (2, 4) |
263 | 264 |
|
| 265 | + def test_fmtloc(self): |
| 266 | + class DummyAxis: |
| 267 | + def __init__(self): |
| 268 | + self.fields = {} |
| 269 | + def set(self, **kwargs): |
| 270 | + self.fields.update(**kwargs) |
| 271 | + def set_major_formatter(self, f): |
| 272 | + self.fields['major_formatter'] = f |
| 273 | + |
| 274 | + ax0 = DummyAxis() |
| 275 | + s0 = AsinhScale(axis=ax0, base=0) |
| 276 | + s0.set_default_locators_and_formatters(ax0) |
| 277 | + assert isinstance(ax0.fields['major_locator'], AsinhLocator) |
| 278 | + assert isinstance(ax0.fields['major_formatter'], str) |
| 279 | + |
| 280 | + ax5 = DummyAxis() |
| 281 | + s7 = AsinhScale(axis=ax5, base=5) |
| 282 | + s7.set_default_locators_and_formatters(ax5) |
| 283 | + assert isinstance(ax5.fields['major_locator'], AsinhLocator) |
| 284 | + assert isinstance(ax5.fields['major_formatter'], |
| 285 | + LogFormatterSciNotation) |
| 286 | + |
264 | 287 | def test_bad_scale(self): |
265 | 288 | fig, ax = plt.subplots() |
266 | 289 |
|
|
0 commit comments