view_init
に最も近いソリューションは直接ax.dist
設定されています。問題は、プロットされたもののみが図の小さな部分を占めるということです。 get_proj
のドキュメントによれば、distは、視点のオブジェクトポイントからの距離である。 initial value is currently hardcodedはdist = 10
です。値が小さいほど(0より大きい)、プロットが拡大されます。
注:この動作は実際には文書化されておらず、変更される可能性があります。軸の限界を変更して関連する部品だけをプロットすることは、ほとんどの場合、おそらくより良い解決策です。これを便利に行うにはax.autoscale(tight=True)
を使用できます。
ワーキングIPython/Jupyter例:
%matplotlib inline
from IPython.display import display
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Grab some test data.
X, Y, Z = axes3d.get_test_data(0.05)
# Plot a basic wireframe.
ax.view_init(90, 0)
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
plt.close()
from ipywidgets import interact
@interact(dist=(1, 20, 1))
def update(dist=10):
ax.dist = dist
display(fig)
出力
dist = 10
dist = 5
出典
2017-06-27 00:38:25
Jan