@@ -766,39 +766,12 @@ def set_label(self, label, *, loc=None, **kwargs):
766
766
`~.Axes.set_ylabel`.
767
767
Supported keywords are *labelpad* and `.Text` properties.
768
768
"""
769
- _pos_xy = 'y' if self .orientation == 'vertical' else 'x'
770
- _protected_kw = [_pos_xy , 'horizontalalignment' , 'ha' ]
771
- if any ([k in kwargs for k in _protected_kw ]):
772
- if loc is not None :
773
- raise TypeError (f'Specifying *loc* is disallowed when any of '
774
- f'its corresponding low level keyword '
775
- f'arguments { _protected_kw } are also supplied' )
776
- loc = 'center'
769
+ if self .orientation == "vertical" :
770
+ self .ax .set_ylabel (label , loc = loc , ** kwargs )
777
771
else :
778
- if loc is None :
779
- loc = mpl .rcParams ['%saxis.labellocation' % _pos_xy ]
780
- if self .orientation == 'vertical' :
781
- _api .check_in_list (('bottom' , 'center' , 'top' ), loc = loc )
782
- else :
783
- _api .check_in_list (('left' , 'center' , 'right' ), loc = loc )
784
- if loc in ['right' , 'top' ]:
785
- kwargs [_pos_xy ] = 1.
786
- kwargs ['horizontalalignment' ] = 'right'
787
- elif loc in ['left' , 'bottom' ]:
788
- kwargs [_pos_xy ] = 0.
789
- kwargs ['horizontalalignment' ] = 'left'
790
- if self .orientation == 'vertical' :
791
- self .ax .set_ylabel (label , ** kwargs )
792
- else :
793
- self .ax .set_xlabel (label , ** kwargs )
772
+ self .ax .set_xlabel (label , loc = loc , ** kwargs )
794
773
self .stale = True
795
774
796
- def _edges (self , X , Y ):
797
- """Return the separator line segments; helper for _add_solids."""
798
- # Using the non-array form of these line segments is much
799
- # simpler than making them into arrays.
800
- return [list (zip (X [i ], Y [i ])) for i in range (1 , len (X ) - 1 )]
801
-
802
775
def _add_solids (self , X , Y , C ):
803
776
"""Draw the colors; optionally add separators."""
804
777
# Cleanup previously set artists.
@@ -814,7 +787,8 @@ def _add_solids(self, X, Y, C):
814
787
self ._add_solids_patches (X , Y , C , mappable )
815
788
else :
816
789
self ._add_solids_pcolormesh (X , Y , C )
817
- self .dividers .set_segments (self ._edges (X , Y ) if self .drawedges else [])
790
+ self .dividers .set_segments (
791
+ np .dstack ([X , Y ])[1 :- 1 ] if self .drawedges else [])
818
792
819
793
def _add_solids_pcolormesh (self , X , Y , C ):
820
794
_log .debug ('Setting pcolormesh' )
0 commit comments