8000 removed assert in `draw_artist` and `redraw_in_frame` · matplotlib/matplotlib@187f584 · GitHub
[go: up one dir, main page]

Skip to content

Commit 187f584

Browse files
committed
removed assert in draw_artist and redraw_in_frame
1 parent b297f41 commit 187f584

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,10 @@ def draw_artist(self, a):
21042104
caches the renderer. It is used to efficiently update Axes
21052105
data (axis ticks, labels, etc are not updated)
21062106
"""
2107-
assert self._cachedRenderer is not None
2107+
if self._cachedRenderer is None:
2108+
msg = draw_artist.__name__ + ''' can only be used after an initial
2109+
draw which caches the render'''
2110+
raise AttributeError(msg)
21082111
a.draw(self._cachedRenderer)
21092112

21102113
def redraw_in_frame(self):
@@ -2113,7 +2116,10 @@ def redraw_in_frame(self):
21132116
caches the renderer. It is used to efficiently update Axes
21142117
data (axis ticks, labels, etc are not updated)
21152118
"""
2116-
assert self._cachedRenderer is not None
2119+
if self._cachedRenderer is None:
2120+
msg = redraw_in_frame.__name__ + ''' can only be used after an
2121+
initial draw which caches the render'''
2122+
raise AttributeError(msg)
21172123
self.draw(self._cachedRenderer, inframe=True)
21182124

21192125
def get_renderer_cache(self):

0 commit comments

Comments
 (0)
0