Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Setting imshow(animated=True) still show does not show an image#30052

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
alphanoobie wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromalphanoobie:minor-issue-4
Open
Show file tree
Hide file tree
Changes fromall 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 deletionlib/matplotlib/axes/_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3174,7 +3174,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
22 changes: 21 additions & 1 deletionlib/matplotlib/tests/test_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,13 +37,14 @@
import matplotlib.text as mtext
import matplotlib.ticker as mticker
import matplotlib.transforms as mtransforms
from matplotlib.backends.backend_agg import FigureCanvasAgg
import mpl_toolkits.axisartist as AA # type: ignore[import]
from numpy.testing import (
assert_allclose, assert_array_equal, assert_array_almost_equal)
from matplotlib.testing.decorators import (
image_comparison, check_figures_equal, remove_ticks_and_titles)
from matplotlib.testing._markers import needs_usetex

from unittest.mock import MagicMock
# Note: Some test cases are run twice: once normally and once with labeled data
# These two must be defined in the same test function or need to have
# different baseline images to prevent race conditions when pytest runs
Expand DownExpand Up@@ -9753,3 +9754,22 @@ def test_pie_all_zeros():
fig, ax = plt.subplots()
with pytest.raises(ValueError, match="All wedge sizes are zero"):
ax.pie([0, 0], labels=["A", "B"])


def test_animated_artists_not_drawn_by_default():
fig, (ax1, ax2) = plt.subplots(ncols=2)
canvas = FigureCanvasAgg(fig)

imdata = np.random.random((20, 20))
lndata = imdata[0]

im = ax1.imshow(imdata, animated=True)
(ln,) = ax2.plot(lndata, animated=True)

im.draw = MagicMock(name="im.draw")
ln.draw = MagicMock(name="ln.draw")

canvas.draw()

im.draw.assert_not_called()
ln.draw.assert_not_called()
Loading

[8]ページ先頭

©2009-2025 Movatter.jp