Skip to content

Cleanup tripcolor() - #22356

Merged
QuLogic merged 3 commits into
matplotlib:mainfrom
timhoffm:triplot
Mar 29, 2022
Merged

QuLogic merged 3 commits into
matplotlib:mainfrom
timhoffm:triplot

Conversation

@timhoffm

@timhoffm timhoffm commented Jan 29, 2022 •

Copy link
Copy Markdown
Member

PR Summary

Commits:

  • Rewrite Triangulation.get_from_args_and_kwargs to make parameter parsing testable; and add tests.
  • Warn when passing triangles or mask alongside a Triangulation to tripcolor()
  • Cleanup logic and documentation of tripcolor()
    This issues additional warnings and more precise error messages but does not change behavior.
    The only "semantic" change is that I have discouraged passing triangles positionally: tripcolor(x, y, triangles, C)
    is a bit odd and IMHO has too many positional arguments.

Closes #22303. Follows up on #10148.

@timhoffm
timhoffm force-pushed the triplot branch 3 times, most recently from 382eca7 to a8b9429 Compare January 29, 2022 23:31
@timhoffm timhoffm changed the title Triplot Cleanup tripcolor() Jan 29, 2022
@timhoffm timhoffm added this to the v3.6.0 milestone Jan 29, 2022

collection.set_alpha(alpha)
collection.set_array(C)
collection.set_array(colors)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While you're at it, probably kwargs should be set last, for the same reason as in #21146/#21525?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But there is collection._scale_norm(norm, vmin, vmax) after setting the norm here. AFAICS this handles the issue in #21146/#21525. One can probably remove that when delaying kwargs setting. But since this PR is already complicated enough and there is no immediate problem, I'd not go into this within this PR.

Comment thread lib/matplotlib/tri/triangulation.py Resolved
Comment thread lib/matplotlib/tri/tripcolor.py Resolved
Comment thread lib/matplotlib/tri/tripcolor.py Resolved
@timhoffm
timhoffm force-pushed the triplot branch 2 times, most recently from be7e1e2 to ef81739 Compare March 27, 2022 07:50
This issues more and more precise warnings on usage errors but does not
change behavior.

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@QuLogic
QuLogic merged commit dfd83c2 into matplotlib:main Mar 29, 2022
@QuLogic

QuLogic commented Mar 29, 2022

Copy link
Copy Markdown
Member

Oops, thought there was a second review; hope you're okay with this @anntzer?

@anntzer

anntzer commented Mar 29, 2022

Copy link
Copy Markdown
Contributor

No worries, opened #22726 to track the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Args for tripcolor

3 participants