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

Skip to content

Incorrect fill_betweenx interpolation #9235

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
dopplershift opened this issue Sep 26, 2017 · 2 comments
Closed

Incorrect fill_betweenx interpolation #9235

dopplershift opened this issue Sep 26, 2017 · 2 comments
Milestone

Comments

@dopplershift
Copy link
Contributor

This sample:

import matplotlib.pyplot as plt
import numpy as np

p = np.array([724.3, 700, 655])
t = np.array([9.4, 7, 2.2])
prof = np.array([7.9, 6.6, 3.8])

fig = plt.figure(figsize=(9, 9))
ax = fig.add_subplot(1, 1, 1)

ax.plot(t, p, 'tab:red')
ax.plot(prof, p, 'k')

ax.fill_betweenx(p, t, prof, where=prof<t,
                            facecolor='blue', interpolate=True, alpha=0.4)
ax.fill_betweenx(p, t, prof, where=prof>t,
                            facecolor='red', interpolate=True, alpha=0.4)

ax.set_xlim(0, 30)
ax.set_ylim(800, 600)

is producing incorrect results on 2.1rc:

fill_between

@dopplershift dopplershift added this to the 2.1.1 (next bug fix release) milestone Sep 26, 2017
@dopplershift
Copy link
Contributor Author

Ah, it works if I reverse all of the data arrays.

dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
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.
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
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.
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
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.
dopplershift added a commit to dopplershift/matplotlib that referenced this issue Sep 26, 2017
@tacaswell
Copy link
Member

Closed by #9236

@QuLogic QuLogic modified the milestones: 2.1.1 (next bug fix release), 2.1 (next point release) Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants