相关疑难解决方法(0)

matplotlib动画,每帧改变颜色条和标题

我在matplotlib做了一个动画.您可以在下面找到我的代码的简化:

# -*- coding: utf-8 -*-

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

begin = 62
eind = 227
verschil = eind - begin

fig = plt.figure()

def f(x, y):
    return np.sin(x) + (0*y)

x = np.linspace(0, 2 * np.pi, 501)
y = np.linspace(0, 2 * np.pi, 501).reshape(-1, 1)

afbeeldinglijst = []
for i in range(verschil):
    x = x + 1
    titel = begin + 1
    afbeelding = plt.imshow(f(x, y))
    afbeeldinglijst.append([afbeelding])
    plt.colorbar()
    plt.title(titel)
    plt.clim(-0.8,0.8)

A …
Run Code Online (Sandbox Code Playgroud)

animation matplotlib title colorbar

6
推荐指数
0
解决办法
1959
查看次数

标签 统计

animation ×1

colorbar ×1

matplotlib ×1

title ×1