Skip to content

Commit d9b7933

Browse files
committed
MNT: simplify splitting z-order rasterized artists out
1 parent c27a1af commit d9b7933

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,10 +3127,12 @@ def draw(self, renderer):
31273127

31283128
if (rasterization_zorder is not None and
31293129
artists and artists[0].zorder < rasterization_zorder):
3130-
artists_rasterized = [a for a in artists
3131-
if a.zorder < rasterization_zorder]
3132-
artists = [a for a in artists
3133-
if a.zorder >= rasterization_zorder]
3130+
split_index = np.searchsorted(
3131+
[art.zorder for art in artists],
3132+
rasterization_zorder, side='right'
3133+
)
3134+
artists_rasterized = artists[:split_index]
3135+
artists = artists[split_index:]
31343136
else:
31353137
artists_rasterized = []
31363138

0 commit comments

Comments
 (0)