相关疑难解决方法(0)

用于散点图的Matplotlib FuncAnimation

我试图使用FuncAnimationMatplotlib动画显示每帧动画一个点的显示.

# modules
#------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as py
from matplotlib import animation

py.close('all') # close all previous plots

# create a random line to plot
#------------------------------------------------------------------------------

x = np.random.rand(40)
y = np.random.rand(40)

py.figure(1)
py.scatter(x, y, s=60)
py.axis([0, 1, 0, 1])
py.show()

# animation of a scatter plot using x, y from above
#------------------------------------------------------------------------------

fig = py.figure(2)
ax = py.axes(xlim=(0, 1), ylim=(0, 1))
scat = ax.scatter([], [], s=60)

def init():
    scat.set_offsets([])
    return scat,

def animate(i): …
Run Code Online (Sandbox Code Playgroud)

python numpy matplotlib python-3.x

6
推荐指数
2
解决办法
9689
查看次数

标签 统计

matplotlib ×1

numpy ×1

python ×1

python-3.x ×1