Skip to content

Instantly share code, notes, and snippets.

@sabopy
Created October 25, 2018 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sabopy/6877a8cd62ba1e0ab30ed7a56c059910 to your computer and use it in GitHub Desktop.
Save sabopy/6877a8cd62ba1e0ab30ed7a56c059910 to your computer and use it in GitHub Desktop.
matplotlib3Dグラフの回転アニメーション
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from IPython.display import HTML
import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# load some test data for demonstration and plot a wireframe
X, Y, Z = axes3d.get_test_data(0.1)
#ax.grid(False)
#ax.set_axis_off()
def init():
ax.plot_wireframe(X, Y, Z, rstride=5, cstride=5)
return fig,
def animate(i):
ax.view_init(elev=30., azim=3.6*i)
return fig,
# Animate
ani = animation.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=100, blit=True)
HTML(ani.to_html5_video())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment