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

autoinfer norms from scale names in the "norm" kwarg of imshow() and friends. #20746

Closed
@anntzer

Description

@anntzer

Problem

Now that Norms are auto-derived from Scales (seemake_norm_from_scale), it may be nice to reuse the scale-name machinery to allow using strings to specify norms, e.g.

imshow(...,norm="log")# => norm=colors.make_norm_from_scale(scale.scale_factory("log"))# a.k.a. norm=colors.LogNorm()

and perhaps

imshow(...,norm=("log",vmin,vmax))

or just allow

imshow(...,norm="log",vmin=vmin,vmax=vmax)

(#15769 deprecatednorm=LogNorm(), vmin=vmin, vmax=vmax but that was because in that case it was unclear whether the passed-in norm should be mutated, whereas here it's always a new norm instance which can thus always be mutated). (I'm not always particularly fond of using strings when objects would be more featureful, but here the machinery for scales is already present and well established so...)

This would seem relatively easy to implement, except for one detail: LogScale currently defaults tononpositive="clip" (see#9477 and the long tree of linked issues for the reason), whereas norms usenonpositive="mask" (which is more or less implied by the existence of APIs likeColormap.set_bad). While this can be resolved in an ad-hoc manner (e.g. by making sure that such scales have anonpositive parameter/attribute and setting it accordingly), I wonder whether a more general solution is possible.

Proposed Solution

As described above.

Additional context and prior art

AFAICT, proplot uses a hard-coded mapping of norm names (https://proplot.readthedocs.io/en/latest/api/proplot.constructor.Norm.html).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp