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

Appearance settings

Commit 9de19d0

Browse filesBrowse files
committed
MNT: be more gentle about resetting the draw method
1 parent b358e6d commit 9de19d0
Copy full SHA for 9de19d0

File tree

Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ def __init_subclass__(cls):
132132

133133
# Decorate draw() method so that all artists are able to stop
134134
# rastrization when necessary.
135-
cls.draw = _prevent_rasterization(cls.draw)
135+
136+
if not hasattr(cls.draw, "_supports_rasterization"):
137+
cls.draw = _prevent_rasterization(cls.draw)
136138

137139
# Inject custom set() methods into the subclass with signature and
138140
# docstring based on the subclasses' properties.

‎lib/matplotlib/tests/test_artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_artist.py
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,3 +535,17 @@ def test_format_cursor_data_BoundaryNorm():
535535
assert img.format_cursor_data(v) == label
536536

537537
plt.close()
538+
539+
540+
def test_auto_no_rasterize():
541+
class Gen1(martist.Artist):
542+
...
543+
544+
assert 'draw' in Gen1.__dict__
545+
assert Gen1.__dict__['draw'] is Gen1.draw
546+
547+
class Gen2(Gen1):
548+
...
549+
550+
assert 'draw' not in Gen2.__dict__
551+
assert Gen2.draw is Gen1.draw

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.