直方图如何指定刻度标签的整数格式并在直方图上显示标准偏差

时间:2019-06-17 15:59:26

标签: python histogram standard-deviation

我知道问题已经here得到了回答。 但是,在我的代码中它不起作用。我不是python专家。这就是我无法正常运行的原因。我正在使用以下代码。

from matplotlib.ticker import FormatStrFormatter
mean = df["Points per Technician per Paid Hour"].mean()
fig = sns.distplot(df["Points per Technician per Paid Hour"])
fig.yaxis.set_major_formatter(FormatStrFormatter('%d'))
plt.yticks(fig.get_yticks(), fig.get_yticks() * 50)
fig.axvline(mean, color='y')

代码输出为

enter image description here

我想只获取不带小数的y轴整数。请教我如何在代码中使用。

我还有一个问题。您可以看到我在直方图中显示了“均值”。我也想显示第一标准偏差。我不知道该怎么做。使用的公式为(平均值+ -1 *标准偏差)。我不确定如何在直方图中显示它。谢谢

0 个答案:

没有答案