@@ -1388,7 +1388,9 @@ class LinearScaleFormatter(Formatter):
1388
1388
interpreted as ``(0, outRef)``.
1389
1389
formatter: matplotlib.ticker.Formatter
1390
1390
The instance to delegate the actual formatting of the
1391
- transformed value to.
1391
+ transformed value to. This does not have to be an instance of
1392
+ ``matplotlib.ticker.Formatter``. Any callable that accepts ``x``
1393
+ and ``pos`` as arguments and returns a string will work.
1392
1394
"""
1393
1395
def __init__ (self , inRef = 1.0 , outRef = 1.0 , formatter = ScalarFormatter ()):
1394
1396
def unpack (ref , name ):
@@ -1420,16 +1422,22 @@ def __call__(self, x, pos=None):
1420
1422
return self .formatter (self .transform (x ), pos )
1421
1423
1422
1424
def set_axis (self , ax ):
1423
- self .formatter .set_axis (ax )
1425
+ if hasattr (self .formatter , 'set_axis' ):
1426
+ self .formatter .set_axis (ax )
1424
1427
1425
1428
def get_offset (self ):
1426
- return self .formatter .get_offset ()
1429
+ if hasattr (self .formatter , 'get_axis' ):
1430
+ return self .formatter .get_offset ()
1431
+ return super (LinearScaleFormatter , self ).get_offset ()
1427
1432
1428
1433
def set_locs (self , locs ):
1429
- self .formatter .set_locs ([self .transform (x ) for x in locs ])
1434
+ if hasattr (self .formatter , 'set_locs' ):
1435
+ self .formatter .set_locs ([self .transform (x ) for x in locs ])
1430
1436
1431
1437
def fix_minus (self , s ):
1432
- return self .formatter .fix_minus (s )
1438
+ if hasattr (self .formatter , 'fix_minus' ):
1439
+ return self .formatter .fix_minus (s )
1440
+ return super (LinearScaleFormatter , self ).fix_minus (s )
1433
1441
1434
1442
1435
1443
class Locator (TickHelper ):
0 commit comments