3

3D プロットの縦軸の指数表記を削除して、整数に置き換えるにはどうすればよいですか? 0.0+2.002e3私の2002サンプルスクリプトは次のとおりです。

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d

yearvec = [2002, 2003, 2004]
plt.close('all')
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlim3d(0, 250)
ax.set_ylim3d(0, 250)
ax.set_zlim3d(yearvec[0], yearvec[-1])
4

1 に答える 1

3

ax.zaxis.set_major_formatterと を使用してみてくださいax.zaxis.set_major_locator:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
from matplotlib.ticker import FormatStrFormatter, MultipleLocator

yearvec = [2002, 2003, 2004, 2005]
plt.close('all')
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlim3d(0, 250)
ax.set_ylim3d(0, 250)
ax.set_zlim3d(yearvec[0], yearvec[-1])

majorLocator   = MultipleLocator(1)
ax.zaxis.set_major_locator(majorLocator)
zFormatter = FormatStrFormatter('%d')
ax.zaxis.set_major_formatter(zFormatter)

これはあなたが望むものですか? ここに画像の説明を入力

于 2016-04-25T15:19:50.650 に答える