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

Fix image interpolation #8966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 31, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FIX: handle degenerate case of all equal values
  • Loading branch information
tacaswell committed Aug 30, 2017
commit b5238acb74f039067651b048853a959cd9a5124e
6 changes: 4 additions & 2 deletions 6 lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
A_scaled = np.empty(A.shape, dtype=scaled_dtype)
A_scaled[:] = A
A_scaled -= a_min
A_scaled /= ((a_max - a_min) / 0.8)
if a_min != a_max:
A_scaled /= ((a_max - a_min) / 0.8)
A_scaled += 0.1
A_resampled = np.zeros((out_height, out_width),
dtype=A_scaled.dtype)
Expand All @@ -408,7 +409,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
# below, but possibly clipped in the case of higher order
# interpolation + drastically changing data.
A_resampled -= 0.1
A_resampled *= ((a_max - a_min) / 0.8)
if a_min != a_max:
A_resampled *= ((a_max - a_min) / 0.8)
A_resampled += a_min
# if using NoNorm, cast back to the original datatype
if isinstance(self.norm, mcolors.NoNorm):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.