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

_make_norm_from_scale needs to process values #19239

Closed
@jklymak

Description

@jklymak

As noted in#18653, norms created viacolors._make_norm_from_scale do not process values that are passed toinverse sonorm.inverse([0.2, 5, 10]) fails, whereasnorm.inverse(np.array([0.2, 5, 10])) works fine.

@QuLogic noticed this:

Probably becauseinverse doesn't passvalue throughprocess_value like__call__ does. Something like:

diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.pyindex e417b8178d..b37ec947fa 100644--- a/lib/matplotlib/colors.py+++ b/lib/matplotlib/colors.py@@ -1449,12 +1449,14 @@ def _make_norm_from_scale(scale_cls, base_norm_cls=None, *, init=None):             t_vmin, t_vmax = self._trf.transform([self.vmin, self.vmax])             if not np.isfinite([t_vmin, t_vmax]).all():                 raise ValueError("Invalid vmin or vmax")+            value, is_scalar = self.process_value(value)             rescaled = value * (t_vmax - t_vmin)             rescaled += t_vmin-            return (self._trf-                    .inverted()-                    .transform(rescaled)-                    .reshape(np.shape(value)))+            t_value = (self._trf+                       .inverted()+                       .transform(rescaled)+                       .reshape(np.shape(value)))+            return t_value[0] if is_scalar else t_value      Norm.__name__ = base_norm_cls.__name__     Norm.__qualname__ = base_norm_cls.__qualname__

Maybe it also needs the masking?

Originally posted by@QuLogic in#18653 (comment)

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