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: colorbars with NoNorm#21872

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
dstansby merged 2 commits intomatplotlib:mainfromtacaswell:fix_nonorm
Dec 8, 2021
Merged

Conversation

tacaswell
Copy link
Member

Closes#21870

This adds another special-case path for NoNorm and tweaks the contents of another.
These special-cases are required because NoNorm (like BoundaryNorm) has a
different return value than ever other Norm (it directly returns integers to
index into the LUT rather than [0, 1] that is later mapped into the LUT.

PR Summary

I added this as an SVG because getting the text right is a critical part of this and SVG will not suffer from our free-type issues.

(I went through a minor panic when I was not seeing ticklabels in the svg, but luckily that was a viewer (emacs) bug 😌 but I did have 15 minutes of thinking we had stopped outputtingany text on SVGs! This may be (another) rsvg bug....)

PR Checklist

Tests and Styling

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

@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelDec 6, 2021
@tacaswelltacaswell added this to thev3.5.1 milestoneDec 6, 2021
@anntzer
Copy link
Contributor

Side tangent about svg: it may be worth switching at least some of the svg baseline outputs to use svg.fonttype = None which simply embeds text as text, gaining a lot on the svg sizes.

tacaswell reacted with thumbs up emoji

Comment on lines 931 to 932
fig.savefig('/tmp/wat.svg')
fig.savefig('/tmp/wat.png')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fig.savefig('/tmp/wat.svg')
fig.savefig('/tmp/wat.png')

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

🤦🏻 At least some of my even more frustrated debugging statements did not make it in!

@@ -839,7 +839,7 @@ def _get_ticker_locator_formatter(self):
# default locator:
nv = len(self._values)
base = 1 + int(nv / 10)
Copy link
Member

Choose a reason for hiding this comment

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

Should this be moved up a level in the elif afterBoundaryNorm? It seems out of place here...

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

indeed.

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.

Added a few suggestions.

Part of my problem with these changes is that they were not exercised with tests and they did not have any comments, so it was pretty hard to know to check the specific cases. I think adding more comments in here will help in the future.

I'd need to think if there is more we can do on the Norm itself to inform the colorbar of how to set locators and ticks. I think we do that now with scales on the norm, so maybe BoundaryNorm and NoNorm can get scales.

tacaswelland others added2 commitsDecember 6, 2021 14:38
Closesmatplotlib#21870This adds another special-case path for NoNorm and tweaks the contents of another.These special-cases are required because NoNorm (like BoundaryNorm) has adifferent return value than ever other Norm (it directly returns integers toindex into the LUT rather than [0, 1] that is later mapped into the LUT.Co-authored-by: Jody Klymak <jklymak@gmail.com>
@tacaswell
Copy link
MemberAuthor

I'd need to think if there is more we can do on the Norm itself to inform the colorbar of how to set locators and ticks. I think we do that now with scales on the norm, so maybe BoundaryNorm and NoNorm can get scales.

I agree, but not as a 3.5.1 patch.

jklymak reacted with thumbs up emoji

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.

Thanks for chasing this down and fixing it, and apologies for breaking it in the first place!

@dstansbydstansby merged commit57dc5f7 intomatplotlib:mainDec 8, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestDec 8, 2021
dstansby added a commit that referenced this pull requestDec 8, 2021
…872-on-v3.5.xBackport PR#21872 on branch v3.5.x (FIX: colorbars with NoNorm)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar
Projects
None yet
Milestone
v3.5.1
Development

Successfully merging this pull request may close these issues.

[Bug]: Colormap + NoNorm only plots one color undermatplotlib 3.5.0
4 participants
@tacaswell@anntzer@jklymak@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp