【发布时间】:2014-03-14 20:06:32
【问题描述】:
我正在使用 python 3.2 和 matplotlib。
x 轴的个数在 0 到 1000000 之间。
在我的情节中,x 轴的数字很长并且相互重叠。
我想在 0 到 10 之间重新缩放和标准化它们,并在 x 轴周围显示单位(例如 10^6)。
我该怎么做?
任何帮助将不胜感激。
【问题讨论】:
标签: python python-3.x windows-7 matplotlib
我正在使用 python 3.2 和 matplotlib。
x 轴的个数在 0 到 1000000 之间。
在我的情节中,x 轴的数字很长并且相互重叠。
我想在 0 到 10 之间重新缩放和标准化它们,并在 x 轴周围显示单位(例如 10^6)。
我该怎么做?
任何帮助将不胜感激。
【问题讨论】:
标签: python python-3.x windows-7 matplotlib
使用set_powerlimits():
import pylab as pl
x = np.linspace(0, 1000000, 100)
y = x * 2
pl.plot(x, y)
ax = pl.gca()
xaxis = ax.xaxis
xaxis.major.formatter.set_powerlimits((0, 4))
【讨论】: