@@ -1568,7 +1568,7 @@ def set_major_formatter(self, formatter):
1568
1568
1569
1569
ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
1570
1570
"""
1571
- if not hasattr (formatter , 'format_data' ):
1571
+ if not isinstance (formatter , mticker . Formatter ):
1572
1572
raise TypeError ("formatter argument should be instance of "
1573
1573
"matplotlib.ticker.Formatter" )
1574
1574
self .isDefault_majfmt = False
@@ -1582,7 +1582,7 @@ def set_minor_formatter(self, formatter):
1582
1582
1583
1583
ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
1584
1584
"""
1585
- if not hasattr (formatter , 'format_data' ):
1585
+ if not isinstance (formatter , mticker . Formatter ):
1586
1586
raise TypeError ("formatter argument should be instance of "
1587
1587
"matplotlib.ticker.Formatter" )
1588
1588
self .isDefault_minfmt = False
@@ -1596,7 +1596,7 @@ def set_major_locator(self, locator):
1596
1596
1597
1597
ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
1598
1598
"""
1599
- if not hasattr (locator , 'tick_values' ):
1599
+ if not isinstance (locator , mticker . Locator ):
1600
1600
raise TypeError ("formatter argument should be instance of "
1601
1601
"matplotlib.ticker.Locator" )
1602
1602
self .isDefault_majloc = False
@@ -1610,7 +1610,7 @@ def set_minor_locator(self, locator):
1610
1610
1611
1611
ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
1612
1612
"""
1613
- if not hasattr (locator , 'tick_values' ):
1613
+ if not isinstance (locator , mticker . Locator ):
1614
1614
raise TypeError ("formatter argument should be instance of "
1615
1615
"matplotlib.ticker.Locator" )
1616
1616
self .isDefault_minloc = False
0 commit comments