@@ -164,17 +164,16 @@ def __init__(
164
164
if isinstance (data , DataFrame ):
165
165
if column :
166
166
self .columns = com .maybe_make_list (column )
167
+ elif self .by is None :
168
+ self .columns = [
169
+ col for col in data .columns if is_numeric_dtype (data [col ])
170
+ ]
167
171
else :
168
- if self .by is None :
169
- self .columns = [
170
- col for col in data .columns if is_numeric_dtype (data [col ])
171
- ]
172
- else :
173
- self .columns = [
174
- col
175
- for col in data .columns
176
- if col not in self .by and is_numeric_dtype (data [col ])
177
- ]
172
+ self .columns = [
173
+ col
174
+ for col in data .columns
175
+ if col not in self .by and is_numeric_dtype (data [col ])
176
+ ]
178
177
179
178
# For `hist` plot, need to get grouped original data before `self.data` is
180
179
# updated later
@@ -504,15 +503,14 @@ def _setup_subplots(self):
504
503
layout = self .layout ,
505
504
layout_type = self ._layout_type ,
506
505
)
506
+ elif self .ax is None :
507
+ fig = self .plt .figure (figsize = self .figsize )
508
+ axes = fig .add_subplot (111 )
507
509
else :
508
- if self .ax is None :
509
- fig = self .plt .figure (figsize = self .figsize )
510
- axes = fig .add_subplot (111 )
511
- else :
512
- fig = self .ax .get_figure ()
513
- if self .figsize is not None :
514
- fig .set_size_inches (self .figsize )
515
- axes = self .ax
510
+ fig = self .ax .get_figure ()
511
+ if self .figsize is not None :
512
+ fig .set_size_inches (self .figsize )
513
+ axes = self .ax
516
514
517
515
axes = flatten_axes (axes )
518
516
@@ -1225,14 +1223,13 @@ def _make_plot(self):
1225
1223
1226
1224
if self .colormap is not None :
1227
1225
cmap = mpl .colormaps .get_cmap (self .colormap )
1226
+ # cmap is only used if c_values are integers, otherwise UserWarning
1227
+ elif is_integer_dtype (c_values ):
1228
+ # pandas uses colormap, matplotlib uses cmap.
1229
+ cmap = "Greys"
1230
+ cmap = mpl .colormaps [cmap ]
1228
1231
else :
1229
- # cmap is only used if c_values are integers, otherwise UserWarning
1230
- if is_integer_dtype (c_values ):
1231
- # pandas uses colormap, matplotlib uses cmap.
1232
- cmap = "Greys"
1233
- cmap = mpl .colormaps [cmap ]
1234
- else :
1235
- cmap = None
1232
+ cmap = None
1236
1233
1237
1234
if color_by_categorical :
1238
1235
from matplotlib import colors
@@ -1630,14 +1627,13 @@ def __init__(self, data, **kwargs) -> None:
1630
1627
self .lim_offset = self .bar_width / 2
1631
1628
else :
1632
1629
self .lim_offset = 0
1630
+ elif kwargs ["align" ] == "edge" :
1631
+ w = self .bar_width / self .nseries
1632
+ self .tickoffset = self .bar_width * (pos - 0.5 ) + w * 0.5
1633
+ self .lim_offset = w * 0.5
1633
1634
else :
1634
- if kwargs ["align" ] == "edge" :
1635
- w = self .bar_width / self .nseries
1636
- self .tickoffset = self .bar_width * (pos - 0.5 ) + w * 0.5
1637
- self .lim_offset = w * 0.5
1638
- else :
1639
- self .tickoffset = self .bar_width * pos
1640
- self .lim_offset = 0
1635
+ self .tickoffset = self .bar_width * pos
1636
+ self .lim_offset = 0
1641
1637
1642
1638
self .ax_pos = self .tick_pos - self .tickoffset
1643
1639
0 commit comments