【问题标题】:Changing Range in Y axis of Boxplot in Python在 Python 中更改 Boxplot 的 Y 轴范围
【发布时间】:2021-06-29 07:25:09
【问题描述】:

如何更改 y 轴值以显示完整的位数?

import seaborn as sns
sns.boxplot (x="waterfront", y="price", data=df)

我希望显示完整的数字范围(如屏幕截图“目标”中),但我创建的箱线图显示了一个带注释的数字(如屏幕截图“当前”中)。

目标:

当前:

【问题讨论】:

  • 请显示您已完成这些数字的代码。此外,您的问题并未说明您用于创建箱线图的 python 库。 :)
  • 将 seaborn 导入为 sns sns.boxplot (x="waterfront", y="price", data=df)

标签: python seaborn boxplot


【解决方案1】:

从这里查看答案:Seaborn / Matplotlib: How to repress scientific notation in factorplot y-axis

这是您需要的代码:

import seaborn as sns
import matplotlib.pyplot as plt

sns.boxplot (x="waterfront", y="price", data=df)
plt.ticklabel_format(style='plain', axis='y',useOffset=False)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-14
    • 2015-03-27
    • 2016-02-26
    • 1970-01-01
    • 2020-04-05
    • 2018-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多