小编Asr*_*lid的帖子

如何从猫图中删除空条

我有两个疑问:

  1. 我想从条形图中删除空条(出现在第一列中)。
  2. 我必须在 PowerPoint 演示文稿中使用此图表。如何增加条形图的高度以使其固定幻灯片的高度?我试图增加高度,但它没有进一步增加。是否可以?如果不是,我可以尝试哪些其他选择?

在此处输入图片说明

plt.figure(figsize=(40,20))
    g = sns.catplot(x = 'Subject', y = 'EE Score',data = df , hue = 'Session',col='Grade',sharey = True,sharex = True,
                    hue_order=["2017-18", "2018-19", "2019-20"], kind="bar");
    #plt.legend(bbox_to_anchor=(1, 1), loc=2) 
    g.set(ylim=(0, 100))
    g.set_axis_labels("Subject", "EE Score")
    
    ax = g.facet_axis(0,0)
    for p in ax.patches:
        ax.text(p.get_x() + 0.015, 
                p.get_height() * 1.02, 
                '{0:.1f}'.format(p.get_height()), 
                color='black', rotation='horizontal', size=12)
    ax = g.facet_axis(0,1)
    for p in ax.patches:
        ax.text(p.get_x() + 0.015, 
                p.get_height() * 1.02, 
                '{0:.1f}'.format(p.get_height()), 
                color='black', rotation='horizontal', size=12)
    ax = g.facet_axis(0,2)
    for p in ax.patches:
        ax.text(p.get_x() + …
Run Code Online (Sandbox Code Playgroud)

python matplotlib bar-chart seaborn catplot

2
推荐指数
1
解决办法
351
查看次数

标签 统计

bar-chart ×1

catplot ×1

matplotlib ×1

python ×1

seaborn ×1