diff --git a/examples/animation/animation_demo.py b/examples/animation/animation_demo.py index beab2801d731..ed88e2d9a418 100644 --- a/examples/animation/animation_demo.py +++ b/examples/animation/animation_demo.py @@ -20,9 +20,9 @@ fig, ax = plt.subplots() -for i in range(len(data)): - ax.cla() - ax.imshow(data[i]) - ax.set_title("frame {}".format(i)) +for i, img in enumerate(data): + ax.clear() + ax.imshow(img) + ax.set_title(f"frame {i}") # Note that using time.sleep does *not* work here! plt.pause(0.1) diff --git a/examples/event_handling/data_browser.py b/examples/event_handling/data_browser.py index 71c72d34854d..42fee3b483c5 100644 --- a/examples/event_handling/data_browser.py +++ b/examples/event_handling/data_browser.py @@ -75,7 +75,7 @@ def update(self): dataind = self.lastind - ax2.cla() + ax2.clear() ax2.plot(X[dataind]) ax2.text(0.05, 0.9, f'mu={xs[dataind]:1.3f}\nsigma={ys[dataind]:1.3f}',