File tree 2 files changed +38
-2
lines changed
2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change
1
+ Deprecations
2
+ ````````````
3
+
4
+ Setting ``Axis.major.locator ``, ``Axis.minor.locator ``, ``Axis.major.formatter ``
5
+ or ``Axis.minor.formatter `` to an object that is not a subclass of `Locator ` or
6
+ `Formatter ` (respectively) is deprecated. Note that these attributes should
7
+ usually be set using `Axis.set_major_locator `, `Axis.set_minor_locator `, etc.
8
+ which already raise an exception when an object of the wrong class is passed.
Original file line number Diff line number Diff line change @@ -640,8 +640,36 @@ class Ticker(object):
640
640
formatter : `matplotlib.ticker.Formatter` subclass
641
641
Determines the format of the tick labels.
642
642
"""
643
- locator = None
644
- formatter = None
643
+
644
+ def __init__ (self ):
645
+ self ._locator = None
646
+ self ._formatter = None
647
+
648
+ @property
649
+ def locator (self ):
650
+ return self ._locator
651
+
652
+ @locator .setter
653
+ def locator (self , locator ):
654
+ if not isinstance (locator , mticker .Locator ):
655
+ cbook .warn_deprecated (
656
+ "3.2" , message = "Support for locators that do not subclass "
657
+ "matplotlib.ticker.Locator is deprecated since %(since)s and "
658
+ "support for them will be removed %(removal)s." )
659
+ self ._locator = locator
660
+
661
+ @property
662
+ def formatter (self ):
663
+ return self ._formatter
664
+
665
+ @formatter .setter
666
+ def formatter (self , formatter ):
667
+ if not isinstance (formatter , mticker .Formatter ):
668
+ cbook .warn_deprecated (
669
+ "3.2" , message = "Support for formatters that do not subclass "
670
+ "matplotlib.ticker.Formatter is deprecated since %(since)s "
671
+ "and support for them will be removed %(removal)s." )
672
+ self ._formatter = formatter
645
673
646
674
647
675
class _LazyTickList (object ):
You can’t perform that action at this time.
0 commit comments