私はそれをプロット[1〜18万] は、x軸に、それは示しています。1 20,000、40,000、...18万 これらの0は、私は単位を変更するにはどうすればよい本当に迷惑matplotlibで軸の単位長を設定する方法は?例えば、X =については
です1、20、40、... 180 と表示され、単位が1000であることも示されています。
私は線形変換を自分で行うことができます。しかし、matplotlibでそれを行う関数はありませんか?
私はそれをプロット[1〜18万] は、x軸に、それは示しています。1 20,000、40,000、...18万 これらの0は、私は単位を変更するにはどうすればよい本当に迷惑matplotlibで軸の単位長を設定する方法は?例えば、X =については
です1、20、40、... 180 と表示され、単位が1000であることも示されています。
私は線形変換を自分で行うことができます。しかし、matplotlibでそれを行う関数はありませんか?
出版品質の数値を目指す場合は、軸ラベルをきめ細かく制御したいと思うでしょう。これを行う1つの方法は、ラベルのテキストを抽出し、独自のカスタム書式を適用することです:
import pylab as plt
import numpy as np
# Create some random data over a large interval
N = 200
X = np.random.random(N) * 10 ** 6
Y = np.sqrt(X)
# Draw the figure to get the current axes text
fig, ax = plt.subplots()
plt.scatter(X,Y)
ax.axis('tight')
plt.draw()
# Edit the text to your liking
label_text = [r"$%i \cdot 10^4$" % int(loc/10**4) for loc in plt.xticks()[0]]
ax.set_xticklabels(label_text)
# Show the figure
plt.show()
あなたは科学的表記にラベルスタイルを設定するためにpyplot.ticklabel_format
を使用することができます。
import pylab as plt
import numpy as np
# Create some random data over a large interval
N = 200
X = np.random.random(N) * 10 ** 6
Y = np.sqrt(X)
# Draw the figure to get the current axes text
fig, ax = plt.subplots()
plt.scatter(X,Y)
ax.axis('tight')
plt.draw()
plt.ticklabel_format(style='sci',axis='x',scilimits=(0,0))
# Edit the text to your liking
#label_text = [r"$%i \cdot 10^4$" % int(loc/10**4) for loc in plt.xticks()[0]]
#ax.set_xticklabels(label_text)
# Show the figure
plt.show()