相关疑难解决方法(0)

Matplotlib pyplot轴格式化程序

我有一张图片:

在此输入图像描述

在y轴上我想得到的5x10^-5 4x10^-5等等而不是0.00005 0.00004.

到目前为止我尝试过的是:

fig = plt.figure()
ax = fig.add_subplot(111)
y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=True)
ax.yaxis.set_major_formatter(y_formatter)

ax.plot(m_plot,densities1,'-ro',label='0.0<z<0.5')
ax.plot(m_plot,densities2, '-bo',label='0.5<z<1.0')


ax.legend(loc='best',scatterpoints=1)
plt.legend()
plt.show() 
Run Code Online (Sandbox Code Playgroud)

这似乎不起作用.代码的文档页面似乎没有提供直接的答案.

python axes matplotlib ticker

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

axes ×1

matplotlib ×1

python ×1

ticker ×1