2016-04-25 17 views
2

3Dプロットの縦軸の科学記法を削除して整数に置き換えるにはどうすればよいですか?代わりに0.0+2.002e3の例えば、私は次のように私のサンプルスクリプトがある2002たい:3Dプロットの縦軸の科学記法を削除する(Python)

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]) 

答えて

1

ax.zaxis.set_major_formatterax.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) 

これは何をしたいのですか? enter image description here

+0

完璧!それはまさに私が探しているものです。ありがとうございました! – AaronJPung

関連する問題