@@ -515,12 +515,11 @@ def _meta_coords(*args, which='x', **kwargs):
515
515
Return the index arrays associated with string coordinates and
516
516
keyword arguments updated with index locators and formatters.
517
517
"""
518
- # NOTE: Why FixedLocator and not IndexLocator? The latter requires plotting
519
- # lines or else an error is raised... very strange .
518
+ # NOTE: Why FixedLocator and not IndexLocator? The ticks chosen by the latter
519
+ # depend on other plotted content .
520
520
# NOTE: Why IndexFormatter and not FixedFormatter? The former ensures labels
521
521
# correspond to indices while the latter can mysteriously truncate labels.
522
- from matplotlib .ticker import NullLocator
523
- from ..ticker import IndexLocator , IndexFormatter
522
+ from ..constuctor import Locator , Formatter
524
523
res = []
525
524
for data in args :
526
525
data = _to_duck_array (data )
@@ -529,12 +528,12 @@ def _meta_coords(*args, which='x', **kwargs):
529
528
continue
530
529
if data .ndim > 1 :
531
530
raise ValueError ('Non-1D string coordinate input is unsupported.' )
532
- idx = np .arange (len (data ))
533
- data = list (map (str , data )) # ensure all are strings
534
- kwargs .setdefault (which + 'locator' , IndexLocator ( 1 , 0 ))
535
- kwargs .setdefault (which + 'formatter' , IndexFormatter ( data ))
536
- kwargs .setdefault (which + 'minorlocator' , NullLocator ( ))
537
- res .append (idx )
531
+ ticks = np .arange (len (data ))
532
+ labels = list (map (str , data ))
533
+ kwargs .setdefault (which + 'locator' , Locator ( ticks , index = False ))
534
+ kwargs .setdefault (which + 'formatter' , Formatter ( labels , index = True ))
535
+ kwargs .setdefault (which + 'minorlocator' , Locator ( 'null' ))
536
+ res .append (ticks ) # use these as data coordinates
538
537
return (* res , kwargs )
539
538
540
539
0 commit comments