@@ -1911,30 +1911,22 @@ def _parse_1d_format(
19111911 if axis .isDefault_label :
19121912 kw_format [sy + 'label' ] = title
19131913
1914- # Convert string-type coordinates
1914+ # Convert string-type coordinates to indices
19151915 # NOTE: This should even allow qualitative string input to hist()
19161916 if autox :
19171917 x , kw_format = inputs ._meta_coords (x , which = sx , ** kw_format )
19181918 if autoy :
19191919 * ys , kw_format = inputs ._meta_coords (* ys , which = sy , ** kw_format )
1920- descending = (
1921- autox
1922- and autoreverse
1923- and x .ndim == 1
1924- and x .size > 1
1925- and np .all (np .sign (np .diff (inputs ._to_numpy_array (x ))) == - 1 )
1926- )
1927- if descending and getattr (self , f'get_autoscale{ sx } _on' )():
1928- kw_format [sx + 'reverse' ] = True
1929-
1930- # Apply formatting
1931- if kw_format :
1932- self .format (** kw_format )
1920+ if autox and autoreverse and inputs ._is_descending (x ):
1921+ if getattr (self , f'get_autoscale{ sx } _on' )():
1922+ kw_format [sx + 'reverse' ] = True
19331923
1934- # Finally strip metadata
1924+ # Finally apply formatting and strip metadata
19351925 # WARNING: Most methods that accept 2D arrays use columns of data, but when
19361926 # pandas DataFrame specifically is passed to hist, boxplot, or violinplot, rows
19371927 # of data assumed! Converting to ndarray necessary.
1928+ if kw_format :
1929+ self .format (** kw_format )
19381930 ys = tuple (map (inputs ._to_numpy_array , ys ))
19391931 if x is not None : # pie() and hist()
19401932 x = inputs ._to_numpy_array (x )
@@ -2004,14 +1996,9 @@ def _parse_2d_format(
20041996 x , kw_format = inputs ._meta_coords (x , which = 'x' , ** kw_format )
20051997 y , kw_format = inputs ._meta_coords (y , which = 'y' , ** kw_format )
20061998 for s , d in zip ('xy' , (x , y )):
2007- descending = (
2008- autoreverse
2009- and d .ndim == 1
2010- and d .size > 1
2011- and np .all (np .sign (np .diff (inputs ._to_numpy_array (d ))) == - 1 )
2012- )
2013- if descending and getattr (self , f'get_autoscale{ s } _on' )():
2014- kw_format [s + 'reverse' ] = True
1999+ if autoreverse and inputs ._is_descending (d ):
2000+ if getattr (self , f'get_autoscale{ s } _on' )():
2001+ kw_format [s + 'reverse' ] = True
20152002
20162003 # Apply formatting
20172004 if kw_format :
0 commit comments