Skip to content

Changed if statement for imshow(animated==true) #28919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3123,7 +3123,7 @@ def draw(self, renderer):
if not self.get_figure(root=True).canvas.is_saving():
artists = [
a for a in artists
if not a.get_animated() or isinstance(a, mimage.AxesImage)]
if not a.get_animated()]
artists = sorted(artists, key=attrgetter('zorder'))

# rasterize artists with negative zorder
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9003,6 +9003,11 @@
with io.BytesIO() as b:
fig.savefig(b, format='pdf')

@check_figures_equal(extensions=["png"])
def test_anim_without_image(fig_test, fig_ref):
ax_ref = fig_ref.subplots()
imdata = np.random.random((20,20))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imdata = np.random.random((20,20))
imdata = np.random.random((20, 20))

ax_ref.plot(imdata, animated=true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ax_ref.plot(imdata, animated=true)
ax_ref.plot(imdata, animated=True)


@image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20",
tol=0.027 if platform.machine() == "arm64" else 0)
Expand All @@ -9019,13 +9024,13 @@
line.set_path_effects([patheffects.withTickedStroke()])
ax.add_artist(line)

line = mpl.lines.Line2D((-1, 1), (-0.5, -0.5), color='r', clip_on=True,

Check failure on line 9027 in lib/matplotlib/tests/test_axes.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E302 expected 2 blank lines, found 1 Raw Output: ./lib/matplotlib/tests/test_axes.py:9027:1: E302 expected 2 blank lines, found 1
clip_path=poly)
ax.add_artist(line)

Check failure on line 9030 in lib/matplotlib/tests/test_axes.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E231 missing whitespace after ',' Raw Output: ./lib/matplotlib/tests/test_axes.py:9030:34: E231 missing whitespace after ','
poly2 = mpl.patches.Polygon(

Check failure on line 9031 in lib/matplotlib/tests/test_axes.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 F821 undefined name 'true' Raw Output: ./lib/matplotlib/tests/test_axes.py:9031:34: F821 undefined name 'true'
[[-1, 1], [0, 1], [0, -0.25]], facecolor="#beefc0", alpha=0.3,
edgecolor="#faded0", linewidth=2, clip_on=True, clip_path=poly)

Check failure on line 9033 in lib/matplotlib/tests/test_axes.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] reported by reviewdog 🐶 E302 expected 2 blank lines, found 1 Raw Output: ./lib/matplotlib/tests/test_axes.py:9033:1: E302 expected 2 blank lines, found 1
ax.add_artist(poly2)

# When text clipping works, the "Annotation" text should be clipped
Expand Down
Loading