Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix issue with colorbar extend and drawedges#22865

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 2 commits intomainfromdrawedgesextend
Jun 15, 2022
Merged

Conversation

oscargus
Copy link
Member

@oscargusoscargus commentedApr 20, 2022
edited
Loading

PR Summary

Closes#22864

Maybe the test can be simplified/written in a better way?

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

Is this new behaviour? Or did it get broken in the colorbar overhaul?

@oscargus
Copy link
MemberAuthor

oscargus commentedApr 20, 2022
edited
Loading

Is this new behaviour? Or did it get broken in the colorbar overhaul?

No idea. Seems to make sense to have it the "new" way, but maybe I miss something. Should be pretty straightforward to add a keyword argument to enable/disable this if required.

Edit: seems like new behavior, at least compared to the last time someone touched those lines.#20054

Edit 2: seems like the concept of removing the first and last element was introduced in4d1107c (see the_edges method, later simplified and inlined).@efiring close to 16 years ago, but do you remember any design decision here?

So probably we would like to introduce a keyword argument for this? Still, I tend to think that the separators are expected when extending, so maybe it should be on by default?

I also assume that a release note should be included then?

@oscargus
Copy link
MemberAuthor

Thinking a bit more about it, it seems like one would like to have the option to disable this. For example if the extend part has the same color as the adjacent block. A good name for the keyword argument?

@oscargusoscargus marked this pull request as draftApril 22, 2022 15:00
@timhoffm
Copy link
Member

timhoffm commentedApr 22, 2022
edited
Loading

IMHO it could be sufficient to draw a line if the extent color (i.e. over/under) is different and not draw a line if the color is the same. That should almost always be the desired behavior. We should not unnecessarily bloat our API with options that nobody needs. We can always add a kwarg later if needed.

@oscargus
Copy link
MemberAuthor

IMHO it could be sufficient to draw a line if the extent color

I've also come to that conclusion after looking at more examples.

@jklymak
Copy link
Member

Further, I'm not sure this is needed at all. I think this is new behaviour, and it may break as many people as it helps. If the extend color is the same, it is probably unwanted to have a break; if the extend color is different, there is a clear visual break anyways. So I'm not sure that there is a lot of semantic aid this is giving that's worth changing behaviour? I'm also against all the special flags and duck typing and checks we have for colorbar - its API has really gotten out of hand over the years.

@timhoffm
Copy link
Member

@jklymak I'm unclear whether you agree with my proposal (not configurable but line/no line depends on the colors) or whether you argue for always no line. I agree neither is a question of semantics, but I think my proposal is better from an aesthetic perspective.

@jklymak
Copy link
Member

I wouldn't add the line...

@efiring
Copy link
Member

I never use drawedges, and I don't know what the old behavior was (but see below). But logically, I think that if drawedges is requested, then thereshould be a line at the base of the triangle, regardless of whether the color changes. It's a boundary with a logical meaning, no different from any of the other boundaries, which also might or might not coincide with a color change. The user has said "draw lines at boundaries", so just do it. I strongly oppose putting in color-checking logic or a kwarg. I'm not strongly opposed to rejecting the change entirely and saying "we will leave this minor inconsistency in place", but I think#22864 is a valid issue.

History: quickly looking at4d1107c, I think this is consistent withdrawing edges at the triangle bases. The _edges method is omitting theends of the bar, which would be the triangle tips when there are extensions, or the actual colorbar ends when there are no extensions. The entire colorbar was drawn as a single pcolormesh; the extensions were not tacked on separately. In other words, I think that the current behavior is new, in which case the current PR is fixing a regression.

jklymak and tvaillantdeguelis reacted with thumbs up emoji

@jklymak
Copy link
Member

OK agreed, this was a regression - if you checkout 3.4.2 then you get the extra lines. So a simple fix as proposed here should be correct.

@oscargus
Copy link
MemberAuthor

Thanks for the feedback!

Will update the PR to check if the extend parts have different or the same color as well.

@efiring
Copy link
Member

@oscargus, to be sure it is clear: There is no point in checking whether the colors are the same or not. The PR will be ready to go with only the code clarification suggested by@timhoffm.

oscargus reacted with thumbs up emoji

@jklymak
Copy link
Member

This is ready to merge when you make the change above, right?

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@oscargus
Copy link
MemberAuthor

Since I messed up and pushed this to the base repo rather than my own and I then changed things to avoid that, I am not really sure how to edit this properly. Hence, I would like to ask for a squash merge.

(Also, the alpha test promised in#23260 (comment) is ideally postponed.)

@oscargusoscargus marked this pull request as ready for reviewJune 14, 2022 08:08
@oscargus
Copy link
MemberAuthor

Ithink the doc build failure is because I pushing this to the main repo. Especially since I didn't change anything related to the docs...

@timhoffmtimhoffm added this to thev3.6.0 milestoneJun 15, 2022
@timhoffmtimhoffm merged commit00cdf28 intomainJun 15, 2022
@timhoffmtimhoffm deleted the drawedgesextend branchJune 15, 2022 16:17
@QuLogic
Copy link
Member

This was a regression from 3.4.2 according to@jklymak, so it should be backported to v3.5.x.

@meeseeksdev backport to v3.5.x

@QuLogicQuLogic modified the milestones:v3.6.0,v3.5.3Jun 15, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJun 15, 2022
QuLogic pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJun 21, 2022
timhoffm added a commit that referenced this pull requestJun 21, 2022
…865-on-v3.5.xBackport PR#22865 on branch v3.5.x (Fix issue with colorbar extend and drawedges)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@efiringefiringefiring approved these changes

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.3
Development

Successfully merging this pull request may close these issues.

[Bug]: Colorbar with drawedges=True and extend='both' does not draw edges at extremities
5 participants
@oscargus@timhoffm@jklymak@efiring@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp