FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix/norm inputs by cvanelteren · Pull Request #693 · Ultraplot/UltraPlot · GitHub

Fix/norm inputs - #693

Merged
cvanelteren merged 11 commits into
mainfrom
fix/norm-inputs
Apr 20, 2026
Merged

Fix/norm inputs#693
cvanelteren merged 11 commits into
mainfrom
fix/norm-inputs

Conversation

cvanelteren commented Apr 16, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Closes #689

When vmin, vmax is given, norms should not be allowed as inputs (as they are part of the norm object). When strings are given, however, we must allow the logic to run.

codecov Bot commented Apr 16, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/tests/test_colorbar.py 94.28% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator Author

@gepcel @munechika-koyo can this be merged?


@pytest.mark.parametrize(
"norm",
["linear", ["linear"], ("linear",)],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
["linear", ["linear"], ("linear",)],
["linear", "log", ["linear"], ("linear",)],

What about trying a different norm?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We could; I am currently just testing against the explicit inputs which are str, list or tuple

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I understand that we conducted the type testing there.
It is probably confirmed somewhere that parsing a string and converting it into the corresponding normalizer is possible, so it might not be necessary here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I will check

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I added this test

@pytest.mark.parametrize("norm", [uplt.DiscreteNorm, uplt.colors.mcolors.Normalize])
def test_normalize_types(norm):
    data = np.random.rand(10, 10)
    target = norm

    print(norm)
    if norm is uplt.DiscreteNorm:
        norm = uplt.DiscreteNorm(levels=[0, 1])
        discrete = True
    elif norm is uplt.colors.mcolors.Normalize:
        norm = uplt.colors.mcolors.Normalize(vmin=0, vmax=1)
        discrete = False
    else:
        raise ValueError("Norm not understood.")
    fig, ax = uplt.subplots()
    cm = ax.pcolormesh(data, norm=norm, discrete=discrete)
    assert isinstance(cm.norm, target)

cvanelteren merged commit 8bf6ccb into main Apr 20, 2026
19 checks passed
cvanelteren deleted the fix/norm-inputs branch April 20, 2026 07:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Normalizer with corresponding parameters doesn't work?

3 participants


Back | FazBrowse Home | New Git URL