matplotlib examples‎ > ‎Posts‎ > ‎

Animated 3D plot

posted Jul 27, 2011, 3:24 AM by Mart Objartel   [ updated Oct 21, 2011, 1:43 AM ]

import matplotlib.pyplot as plt

import mpl_toolkits.mplot3d.axes3d as axes3d


fig = plt.figure(figsize=(4,4))

ax1 = fig.add_subplot(1, 1, 1, projection='3d')


#data


x = [1,2,3,4,5]

y = [23, 34, 23, 34, 45]

z = [3, 4, 6, 7, 5]


ax1.plot(x,y,z)


for i in range(0, 180):

    ax1.azim = i

#   ax1.elev = 30

    name = "anim_%s.png " % i

    plt.savefig(name, format="png")


#plt.show()


this script will only generate image sequence that can be imported into VirtualDub (http://www.virtualdub.org/), Adobe Flash(R) or some other software to encode it into video/flash/gif




ċ
3d_animation.py
(0k)
Mart Objartel,
Jul 27, 2011, 3:37 AM
Comments