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

Skip to content

Fix fill_between with decreasing data #9236

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 2 commits into from
Sep 26, 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
Next Next commit
BUG: Fix fill_between(x) with decreasing data (Fixes #9235)
One of the calls to interp passes data which is not guaranteed to be in
increasing order, which interp requires. Just use argsort the data, like
is done above.
  • Loading branch information
dopplershift committed Sep 26, 2017
commit e6a115c936e47e21b4de9b1374cfc296fdb240a2
8 changes: 6 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4876,7 +4876,9 @@ def get_interp_point(ind):
diff_order = diff_values.argsort()
diff_root_x = np.interp(
0, diff_values[diff_order], x_values[diff_order])
diff_root_y = np.interp(diff_root_x, x_values, y1_values)
x_order = x_values.argsort()
diff_root_y = np.interp(diff_root_x, x_values[x_order],
y1_values[x_order])
return diff_root_x, diff_root_y

start = get_interp_point(ind0)
Expand Down Expand Up @@ -5026,7 +5028,9 @@ def get_interp_point(ind):
diff_order = diff_values.argsort()
diff_root_y = np.interp(
0, diff_values[diff_order], y_values[diff_order])
diff_root_x = np.interp(diff_root_y, y_values, x1_values)
y_order = y_values.argsort()
diff_root_x = np.interp(diff_root_y, y_values[y_order],
x1_values[y_order])
return diff_root_x, diff_root_y

start = get_interp_point(ind0)
Expand Down