8000 Slightly improve streamplot code legibility. · matplotlib/matplotlib@1820339 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1820339

Browse files
committed
Slightly improve streamplot code legibility.
`__getitem__` is never called with more than a single arg, and we can just use normal indexing on _mask both for getting and for setting.
1 parent 9c4e686 commit 1820339

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/streamplot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ def __init__(self, density):
380380

381381
self._current_xy = None
382382

383-
def __getitem__(self, *args):
384-
return self._mask.__getitem__(*args)
383+
def __getitem__(self, args):
384+
return self._mask[args]
385385

386386
def _start_trajectory(self, xm, ym):
387387
"""Start recording streamline trajectory"""
@@ -391,7 +391,7 @@ def _start_trajectory(self, xm, ym):
391391
def _undo_trajectory(self):
392392
"""Remove current trajectory from mask"""
393393
for t in self._traj:
394-
self._mask.__setitem__(t, 0)
394+
self._mask[t] = 0
395395

396396
def _update_trajectory(self, xm, ym):
397397
"""Update current trajectory position in mask.

0 commit comments

Comments
 (0)
0