【问题标题】:Creating Axis Labels on Seaborn Countplot在 Seaborn Countplot 上创建轴标签
【发布时间】:2020-07-12 16:29:18
【问题描述】:

我想将轴标签添加到我使用以下代码创建的 Seaborn 计数图:

chart = sns.countplot(df_["HOURS"]).set_title("Number of Calls Reporting Burglary For Each Day of the Week")

我尝试使用以下方法为 X 和 Y 轴创建标签:

#.set(xlabel='Hour', ylabel='Number of Calls')

但是,这返回了:

AttributeError: 'Text' object has no property 'ylabel'

如何在此图上添加 x 和 y 标签?

【问题讨论】:

    标签: python pandas data-visualization seaborn


    【解决方案1】:

    import matplotlib.pyplot as plt
    
    chart.set(xlabel='', ylabel='')
    plt.show()
    

    Seaborn 没有设置标签的明确方法。将 matplotlib 与 seaborn 一起使用,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2015-10-16
      • 2015-02-10
      • 1970-01-01
      • 2018-07-26
      • 1970-01-01
      • 1970-01-01
      • 2017-07-22
      • 2023-01-23
      • 1970-01-01
      相关资源
      最近更新 更多