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 72e1c6c

Browse filesBrowse files
committed
contourf: use np.inf instead of 1e300 for out-of-range color levels
Note that trying to simplify the code further by using np.inf a few lines above, in self._levels, does not work; I'm not sure what it breaks, but it definitely breaks something, probably in the colorbar code.
1 parent bca3321 commit 72e1c6c
Copy full SHA for 72e1c6c

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,11 +1043,11 @@ def _process_levels(self):
10431043
# layer values are mid-way between levels
10441044
self.layers = 0.5 * (self._levels[:-1] + self._levels[1:])
10451045
# ...except that extended layers must be outside the
1046-
# normed range, so use huge values:
1046+
# normed range:
10471047
if self.extend in ('both', 'min'):
1048-
self.layers[0] = -1e300
1048+
self.layers[0] = -np.inf
10491049
if self.extend in ('both', 'max'):
1050-
self.layers[-1] = 1e300
1050+
self.layers[-1] = np.inf
10511051
else:
10521052
self.layers = self.levels # contour: a line is a thin layer
10531053
# Use only original levels--no extended levels

0 commit comments

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