Если вы посмотрите на plot.axes.shape
, вы увидите, что массив осей - это не (2,4), как вы ожидаете, а (8,) одномерный массив.Это потому, что вы используете col_wrap
, а не определяете сетку макета.
plot = sns.catplot(x='Year',
y='Graduation Rate',
col='Group',
hue='Campus',
kind='bar',
col_wrap=4,
data=df_sum.sort_values(['Group', 'Campus']))
for i in np.arange(8):
# for j in np.arange(4):
ax1 = plot.facet_axis(0,i)
for p in ax1.patches:
if str(p.get_height()) != 'nan':
ax1.text(p.get_x() + 0.06, p.get_height() * .8, '{0:.2f}%'.format(p.get_height()), color='white', rotation='vertical', size='large')
Вывод:
![enter image description here](https://i.stack.imgur.com/TQW9U.png)
PS,Я посещал Букера Т. Вашингтона (HSEP).Где моя школа HISD здесь?