@@ -1999,7 +1999,9 @@ def _set_formatter(self, formatter, level):
19991999
20002000 if (isinstance (formatter , mticker .FixedFormatter )
20012001 and len (formatter .seq ) > 0
2002- and not isinstance (level .locator , mticker .FixedLocator )):
2002+ and not isinstance (level .locator , mticker .FixedLocator )
2003+ and not (hasattr (level .locator , 'base' ) and
2004+ isinstance (level .locator .base , mticker .FixedLocator ))):
20032005 _api .warn_external ('FixedFormatter should only be used together '
20042006 'with FixedLocator' )
20052007
@@ -2142,16 +2144,21 @@ def set_ticklabels(self, labels, *, minor=False, fontdict=None, **kwargs):
21422144 if not labels :
21432145 # eg labels=[]:
21442146 formatter = mticker .NullFormatter ()
2145- elif isinstance (locator , mticker .FixedLocator ):
2147+ elif (isinstance (locator , mticker .FixedLocator ) or
2148+ (hasattr (locator , 'base' ) and
2149+ isinstance (locator .base , mticker .FixedLocator ))):
2150+ # Also handles locators that wrap a FixedLocator (e.g. RadialLocator).
2151+ fixed_locator = (locator if isinstance (locator , mticker .FixedLocator )
2152+ else locator .base )
21462153 # Passing [] as a list of labels is often used as a way to
21472154 # remove all tick labels, so only error for > 0 labels
2148- if len (locator .locs ) != len (labels ) and len (labels ) != 0 :
2155+ if len (fixed_locator .locs ) != len (labels ) and len (labels ) != 0 :
21492156 raise ValueError (
21502157 "The number of FixedLocator locations"
2151- f" ({ len (locator .locs )} ), usually from a call to"
2158+ f" ({ len (fixed_locator .locs )} ), usually from a call to"
21522159 " set_ticks, does not match"
21532160 f" the number of labels ({ len (labels )} )." )
2154- tickd = {loc : lab for loc , lab in zip (locator .locs , labels )}
2161+ tickd = {loc : lab for loc , lab in zip (fixed_locator .locs , labels )}
21552162 func = functools .partial (self ._format_with_dict , tickd )
21562163 formatter = mticker .FuncFormatter (func )
21572164 else :
0 commit comments