10000 Add PiecewiseLinearNorm by dopplershift · Pull Request #4666 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add PiecewiseLinearNorm #4666

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

Closed
wants to merge 17 commits into from
Closed
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 bad indexing when returning a scalar
  • Loading branch information
phobson committed Jun 8, 2015
commit ab113809cc172b196fe2d564541430643dfec4cb
4 changes: 1 addition & 3 deletions lib/matplotlib/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,11 +1034,9 @@ def __call__(self, value, clip=None):
mask=mask)

x, y = [vmin, vcenter, vmax], [0, 0.5, 1]
# returns a scalar if shape == (1,)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to hold at least for numpy 1.9.2:

In [29]: np.ma.masked_array(np.interp([5], [0,8,10], [0,0.5,1]))
Out[29]: 
masked_array(data = [ 0.3125],
             mask = False,
       fill_value = 1e+20)

In [30]: _.shape
Out[30]: (1,)

result = np.ma.masked_array(np.interp(value, x, y))

if is_scalar:
result = result[0]

return result

def autoscale_None(self, A):
Expand Down
0