Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8fe72c

Browse files
committed
Fix and use STEP_LOOKUP_MAP, for consistency.
1 parent 722f405 commit b8fe72c

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

lib/matplotlib/cbook.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,12 +2403,14 @@ def pts_to_midstep(x, *args):
24032403
# convert 2D array back to tuple
24042404
return tuple(steps)
24052405

2406-
STEP_LOOKUP_MAP = {'pre': pts_to_prestep,
2406+
STEP_LOOKUP_MAP = {'default': lambda x, y: (x, y),
2407+
'pre': pts_to_prestep,
24072408
'post': pts_to_poststep,
24082409
'mid': pts_to_midstep,
2409-
'step-pre': pts_to_prestep,
2410-
'step-post': pts_to_poststep,
2411-
'step-mid': pts_to_midstep}
2410+
'steps': pts_to_prestep,
2411+
'steps-pre': pts_to_prestep,
2412+
'steps-post': pts_to_poststep,
2413+
'steps-mid': pts_to_midstep}
24122414

24132415

24142416
def index_of(y):

lib/matplotlib/lines.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from . import artist, colors as mcolors
1818
from .artist import Artist
1919
from .cbook import (iterable, is_string_like, is_numlike, ls_mapper_r,
20-
pts_to_prestep, pts_to_poststep, pts_to_midstep)
20+
STEP_LOOKUP_MAP)
2121

2222
from .path import Path
2323
from .transforms import Bbox, TransformedPath, IdentityTransform
@@ -245,14 +245,6 @@ class Line2D(Artist):
245245
drawStyleKeys = (list(six.iterkeys(_drawStyles_l)) +
246246
list(six.iterkeys(_drawStyles_s)))
247247

248-
_drawstyle_conv = {
249-
'default': lambda x, y: (x, y),
250-
'steps': pts_to_prestep,
251-
'steps-pre': pts_to_prestep,
252-
'steps-mid': pts_to_midstep,
253-
'steps-post': pts_to_poststep
254-
}
255-
256248
# Referenced here to maintain API. These are defined in
257249
# MarkerStyle
258250
markers = MarkerStyle.markers
@@ -688,7 +680,7 @@ def recache(self, always=False):
688680
interpolation_steps = self._path._interpolation_steps
689681
else:
690682
interpolation_steps = 1
691-
xy = self._drawstyle_conv[self._drawstyle](*self._xy.T)
683+
xy = STEP_LOOKUP_MAP[self._drawstyle](*self._xy.T)
692684
self._path = Path(np.asarray(xy).T, None, interpolation_steps)
693685
self._transformed_path = None
694686
self._invalidx = False

0 commit comments

Comments
 (0)