Skip to content
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

Fillbetween #6560

Merged
merged 1 commit into from Nov 5, 2016
Merged

Fillbetween #6560

merged 1 commit into from Nov 5, 2016

Conversation

rmlopes
Copy link
Contributor

@rmlopes rmlopes commented Jun 8, 2016

As discussed in issue #6543. Added the interpolate argument just before the **kwargs.

I think I made a mistake, I wanted to target the 1.5.x. I'll be waiting for some input. :)

Should I edit the changelog as well?

@tacaswell
Copy link
Member

You targeted the right branch. If merged, this will ship with 2.1 at the earliest.

"""
Make filled polygons between two horizontal curves.

Call signature::

fill_betweenx(y, x1, x2=0, where=None, **kwargs)
fill_betweenx(y, x1, x2=0, where=None, step=None, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

can you also add interpolate here?

@tacaswell
Copy link
Member

Can you add an entry in docs/user/whats_new (the README in that folder has instructions).

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jun 8, 2016
@rmlopes
Copy link
Contributor Author

rmlopes commented Jun 8, 2016

What is the problem here? I can't see the indicated errors.

AssertionError: 2 != 0 : Found code syntax errors (and warnings):
/home/travis/build/matplotlib/matplotlib/lib/matplotlib/axes/_axes.py:4806:80: E501 line too long (88 > 79 characters)
/home/travis/build/matplotlib/matplotlib/lib/matplotlib/axes/_axes.py:4907:60: W291 trailing whitespace

@tacaswell
Copy link
Member

That is odd that it is reporting lines outside of where you touched. This may be due to a bad merge somewhere else?

@QuLogic
Copy link
Member

QuLogic commented Jun 8, 2016

master probably has some deleted lines so the merge commit that's being tested has different line numbers. However, it's pretty obvious that line 4856 is too long. As for the trailing whitespace, it will be easier if you configure your editor to strip them on save.

@rmlopes
Copy link
Contributor Author

rmlopes commented Jun 9, 2016

There is once again a flake failure, in a line that is not part of the diff - 4908 (and I have already configured the editor to remove trailing spaces on write).

There is an unrelated test failing as well at the image comparison:
FAIL: matplotlib.tests.test_mathtext.test_mathfont_dejavusans_03.test

What should I do?


The ``interpolate`` parameter now exists for the method :func:`fill_betweenx`. This allows
a user to interpolate the data and fill the areas in the crossover points, similarly to :func:`fill_between`.
::
Copy link
Member

Choose a reason for hiding this comment

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

The :: indicates there will be a code block following; it should be removed (or an example added.)

@QuLogic
Copy link
Member

QuLogic commented Jun 9, 2016

There is an unrelated test failing as well at the image comparison:
FAIL: matplotlib.tests.test_mathtext.test_mathfont_dejavusans_03.test

That comes and goes; you can ignore it.

@rmlopes
Copy link
Contributor Author

rmlopes commented Jun 13, 2016

I will implement the tests for fill_betweenx with and without interpolate because it is missing. I have had some issues with the figures in other libraries (small differences in the fonts to the generated by travis). Is there some kind of procedure (like run the test in travis first, then go to the error message to pick the expected image) in place?

@rmlopes
Copy link
Contributor Author

rmlopes commented Jun 23, 2016

@tacaswell I was just wondering, since this is such a trivial change, why not merge this before 2.1? Would it make a difference if the test coverage increased?

@tacaswell
Copy link
Member

This is a new feature and 2.1 is the next release with planned new features. The 1.5.x series is only getting critical (as in fixing regressions / does not compile / show stopper) bug fixes, and the 2.x series is only getting changes needed to get the style updates out the door.

This seems to need a rebase.

@tacaswell
Copy link
Member

ping @rmlopes can you rebase this?

@rmlopes
Copy link
Contributor Author

rmlopes commented Jul 13, 2016

@tacaswell I rebased by squashing every commit into the first, then forced the push as the history is incompatible. Looks like this may not have been the correct approach though.

@tacaswell
Copy link
Member

You now need to rebase that single commit onto current master and force-push again.

@rmlopes
Copy link
Contributor Author

rmlopes commented Jul 13, 2016

Should be ok now.

@tacaswell
Copy link
Member

Something went wrong here, htere should not be this many commits. See http://matplotlib.org/devdocs/devel/gitwash/development_workflow.html?highlight=rebase#rebasing-a-pull-request-pr

Copy link
Member

@NelleV NelleV left a comment

Choose a reason for hiding this comment

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

Overall, this looks good.
I've added a comment, but I think this PR has been going on for so long that we should merge it and do the maintenance in another PR.

Y = np.zeros((2 * N + 2, 2), float)
Y = np.zeros((2 * N + 2, 2), np.float)
if interpolate:
def get_interp_point(ind):
Copy link
Member

Choose a reason for hiding this comment

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

Is this the exact same function as in fill_between?
If so, I think it should be factored out and moved to the cbook module as a private function.

Copy link
Contributor Author

@rmlopes rmlopes Nov 1, 2016

Choose a reason for hiding this comment

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

I think so. I thought about that but also about using some interpolation function maintained and alerady available in scipy (would this be a bad idea perhaps?). I'll have a look at it as soon as I can.

Copy link
Member

Choose a reason for hiding this comment

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

scipy isn't a dependency, so using their functions isn't an option unless you copy paste them in a module of ours.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The two methods differ on the axes of interpolation only. Could be a single function indeed. I can make this in a new branch but I need to know where to add the interpolate function.
This solution is actually very slow for my use case since I am displaying a few thousand seismic traces, so I would like to keep working on this.

@QuLogic
Copy link
Member

QuLogic commented Oct 29, 2016

Can you amend the commit and edit the commit message to remove the duplicate information and the comments from git?

@NelleV NelleV changed the title Fillbetween [MRG+1] Fillbetween Oct 29, 2016
@rmlopes
Copy link
Contributor Author

rmlopes commented Nov 1, 2016

I did a rebase squashing 2 commits but somehow ended up with three commits.

@NelleV
Copy link
Member

NelleV commented Nov 1, 2016

Thanks @rmlopes ! I'll merge this as soon as the tests have passed.

Interpolation in fill_betweenx
------------------------------

The ``interpolate`` parameter now exists for the method :func:`fill_betweenx`.
Copy link
Member

Choose a reason for hiding this comment

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

It's a method on a class, not a function, so will this cross-reference work?

"""
Make filled polygons between two horizontal curves.

Call signature::
Copy link
Member

Choose a reason for hiding this comment

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

Please don't add the call signature back; it is redundant.

…nabled through keyword argument interpolate.
@efiring
Copy link
Member

efiring commented Nov 1, 2016

On 2016/11/01 10:10 AM, Rui Lopes wrote:

This solution is actually very slow for my use case since I am
displaying a few thousand seismic traces, so I would like to keep
working on this.

Yes, there should be some scope for vectorization here. At the very
least, all necessary interpolation can be done in a single call to
interp for the whole array. I suspect the entire operation can be
vectorized; I don't see any inherent need for loops.

@NelleV
Copy link
Member

NelleV commented Nov 5, 2016

I'll merge this, but @rmlopes feel free to continue working on this and open a new PR!

@NelleV NelleV merged commit 3ff9fa8 into matplotlib:master Nov 5, 2016
@QuLogic QuLogic changed the title [MRG+1] Fillbetween Fillbetween Nov 5, 2016
dopplershift added a commit to dopplershift/MetPy that referenced this pull request Apr 17, 2017
This backports matplotlib/matplotlib#6560 so that shading things like
CAPE/CIN now properly fill up to the cross-over point.
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

Successfully merging this pull request may close these issues.

None yet

6 participants