在 Python 中更改 Boxplot 的 Y 轴范围

时间:2021-06-29 07:25:09

标签: python seaborn boxplot

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

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

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

目标:

Target scale

当前:

Current scale

1 个答案:

答案 0 :(得分:0)

从这里查看答案: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)

example picture