From 6a24855a03335991395e56ab8ef54dca685d65cb Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 31 Aug 2022 03:01:49 -0400 Subject: [PATCH] Remove `Axes.cla` from examples Also, minor improvement to animation demo. --- examples/animation/animation_demo.py | 8 ++++---- examples/event_handling/data_browser.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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}',