Seaborn / Matplotlib:如何在 factorplot y 轴中抑制科学记数法
Seaborn / Matplotlib: How to repress scientific notation in factorplot y-axis
下面这个我无法解决的问题的简单示例。
N.B。其他一些 Seaborn 绘图方法似乎有抑制指数形式的论据,但似乎没有 factorplots
。我尝试了一些 Matplotlib 解决方案,包括 similar question but none work. Also this is not a dupe of 中建议的解决方案。我非常频繁地使用 factorplots 并且理想情况下希望找到一个合适的解决方案而不是解决方法。
data = {'reports': [4, 24, 31, 2, 3],'coverage': [35050800, 54899767, 57890789, 62890798, 70897871]}
df = pd.DataFrame(data)
df
生成此数据帧:
coverage reports
0 35050800 4
1 54899767 24
2 57890789 31
3 62890798 2
4 70897871 3
然后是这个 Seaborn 代码:
sns.factorplot(y="coverage", x="reports", kind='bar', data=df, label="Total")
产生这个情节:
有没有办法让 y 轴根据 coverage
值显示适当的数字刻度?
看来下一行解决了问题:
plt.ticklabel_format(style='plain', axis='y')
这里是 documentation link.
下一行为我解决了这个问题(除了托尼的回答)
sns.plt.ticklabel_format(style='plain', axis='y',useOffset=False)
下面这个我无法解决的问题的简单示例。
N.B。其他一些 Seaborn 绘图方法似乎有抑制指数形式的论据,但似乎没有 factorplots
。我尝试了一些 Matplotlib 解决方案,包括 similar question but none work. Also this is not a dupe of
data = {'reports': [4, 24, 31, 2, 3],'coverage': [35050800, 54899767, 57890789, 62890798, 70897871]}
df = pd.DataFrame(data)
df
生成此数据帧:
coverage reports
0 35050800 4
1 54899767 24
2 57890789 31
3 62890798 2
4 70897871 3
然后是这个 Seaborn 代码:
sns.factorplot(y="coverage", x="reports", kind='bar', data=df, label="Total")
产生这个情节:
有没有办法让 y 轴根据 coverage
值显示适当的数字刻度?
看来下一行解决了问题:
plt.ticklabel_format(style='plain', axis='y')
这里是 documentation link.
下一行为我解决了这个问题(除了托尼的回答)
sns.plt.ticklabel_format(style='plain', axis='y',useOffset=False)