[英]How to control scientific notation in matplotlib?
这是我要绘制的数据框:
my_dic = {'stats': {'apr': 23083904,
'may': 16786816,
'june': 26197936,
}}
my_df = pd.DataFrame(my_dic)
my_df.head()
这是我的绘图方式:
ax = my_df['stats'].plot(kind='bar', legend=False)
ax.set_xlabel("Month", fontsize=12)
ax.set_ylabel("Stats", fontsize=12)
ax.ticklabel_format(useOffset=False) #AttributeError: This method only works with the ScalarFormatter.
plt.show()
剧情:
我想控制科学计数法。 我试图按照其他问题plt.ticklabel_format(useOffset=False)
建议通过此行来抑制它,但是我得到了此错误AttributeError: This method only works with the ScalarFormatter
。 理想情况下,我想以(mln)显示数据。
由于您已经在使用pandas
import matplotlib.pyplot as plt
my_df.plot(kind='bar')
plt.ticklabel_format(style='plain', axis='y')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.