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

Use collections.deque to store animation cache data.#30206

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

Merged
jkseppan merged 1 commit intomatplotlib:mainfromanntzer:ad
Jun 24, 2025
Merged
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
11 changes: 5 additions & 6 deletionslib/matplotlib/animation.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import abc
import base64
import collections
import contextlib
from io import BytesIO, TextIOWrapper
import itertools
Expand DownExpand Up@@ -1708,13 +1709,13 @@
self._cache_frame_data = cache_frame_data

# Needs to be initialized so the draw functions work without checking
self._save_seq =[]
self._save_seq =collections.deque([], self._save_count)

super().__init__(fig, **kwargs)

# Need to reset the saved seq, since right now it will contain data
# for a single frame from init, which is not what we want.
self._save_seq = []
self._save_seq.clear()

def new_frame_seq(self):
# Use the generating function to generate a new frame sequence
Expand All@@ -1727,8 +1728,7 @@
if self._save_seq:
# While iterating we are going to update _save_seq
# so make a copy to safely iterate over
self._old_saved_seq = list(self._save_seq)
return iter(self._old_saved_seq)
return iter([*self._save_seq])

Check warning on line 1731 in lib/matplotlib/animation.py

View check run for this annotation

Codecov/ codecov/patch

lib/matplotlib/animation.py#L1731

Added line #L1731 was not covered by tests
else:
if self._save_count is None:
frame_seq = self.new_frame_seq()
Expand DownExpand Up@@ -1773,13 +1773,12 @@
'return a sequence of Artist objects.')
for a in self._drawn_artists:
a.set_animated(self._blit)
self._save_seq = []
self._save_seq.clear()

def _draw_frame(self, framedata):
if self._cache_frame_data:
# Save the data for potential saving of movies.
self._save_seq.append(framedata)
self._save_seq = self._save_seq[-self._save_count:]

# Call the func with framedata and args. If blitting is desired,
# func needs to return a sequence of any artists that were modified.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp