动画Steronets

时间:2018-03-23 22:49:17

标签: python-2.7 animation matplotlib

我一直在环顾四周,无处可去。我试图在立体声图上为极点设置动画。但是,电线杆不会出现在它们所在的位置。

图1 是动画极点情节,而图2 是情节应该如何。我想知道是否有人知道如何处理这个问题?

import matplotlib as mpl
mpl.use("TkAgg")
from matplotlib import pyplot as plt
from matplotlib import animation
import numpy as np
import mplstereonet

fig, ax = mplstereonet.subplots()
fig2, ax1 = mplstereonet.subplots()

ax.grid(True)
ax1.grid(True)

# Assume a strike and dip with a random variance.
# Current values should plot the poles at either 0, 180
strike, dip = 90, 80
num = 10

strikes = strike + 10 * np.random.randn(num)
dips = dip + 10 * np.random.randn(num)

poles, = ax.pole([], [], 'o')

def init():
    poles.set_data([], [])
    return poles,

def animate(i):
    poles.set_data(strikes[:i], dips[:i])
    return poles,

anim = animation.FuncAnimation(fig, animate, init_func=init,
                               frames = len(strikes), interval = 100, blit=True, repeat=False)

poles1 = ax1.pole(strikes, dips, 'o') # This is how the final image should look like
plt.show()

0 个答案:

没有答案