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 92de753

Browse filesBrowse files
committed
Shorten contour._make_paths_from_contour_generator.
1 parent ab70fac commit 92de753
Copy full SHA for 92de753

File tree

Expand file treeCollapse file tree

1 file changed

+7
-15
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-15
lines changed

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+7-15Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,22 +1114,14 @@ def _make_paths_from_contour_generator(self):
11141114
"""Compute ``paths`` using C extension."""
11151115
if self._paths is not None:
11161116
return self._paths
1117-
paths = []
1117+
cg = self._contour_generator
11181118
empty_path = Path(np.empty((0, 2)))
1119-
if self.filled:
1120-
lowers, uppers = self._get_lowers_and_uppers()
1121-
for level, level_upper in zip(lowers, uppers):
1122-
vertices, kinds = \
1123-
self._contour_generator.create_filled_contour(
1124-
level, level_upper)
1125-
paths.append(Path(np.concatenate(vertices), np.concatenate(kinds))
1126-
if len(vertices) else empty_path)
1127-
else:
1128-
for level in self.levels:
1129-
vertices, kinds = self._contour_generator.create_contour(level)
1130-
paths.append(Path(np.concatenate(vertices), np.concatenate(kinds))
1131-
if len(vertices) else empty_path)
1132-
return paths
1119+
vertices_and_codes = (
1120+
map(cg.create_filled_contour, *self._get_lowers_and_uppers())
1121+
if self.filled else
1122+
map(cg.create_contour, self.levels))
1123+
return [Path(np.concatenate(vs), np.concatenate(cs)) if len(vs) else empty_path
1124+
for vs, cs in vertices_and_codes]
11331125

11341126
def _get_lowers_and_uppers(self):
11351127
"""

0 commit comments

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