Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d5a67d

Browse files
authored
Merge pull request #21118 from meeseeksmachine/auto-backport-of-pr-21112-on-v3.5.x
Backport PR #21112 on branch v3.5.x (Fix make_norm_from_scale `__name__` when used inline.)
2 parents 605c6cb + 6a52684 commit 6d5a67d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/colors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,8 @@ def inverse(self, value):
15611561
.reshape(np.shape(value)))
15621562
return value[0] if is_scalar else value
15631563

1564-
Norm.__name__ = base_norm_cls.__name__
1564+
Norm.__name__ = (f"{scale_cls.__name__}Norm" if base_norm_cls is Normalize
1565+
else base_norm_cls.__name__)
15651566
Norm.__qualname__ = base_norm_cls.__qualname__
15661567
Norm.__module__ = base_norm_cls.__module__
15671568
Norm.__doc__ = base_norm_cls.__doc__

lib/matplotlib/tests/test_colors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,3 +1475,9 @@ def test_norm_update_figs(fig_test, fig_ref):
14751475
# Force initial draw to make sure it isn't already stale
14761476
fig_test.canvas.draw()
14771477
norm.vmin, norm.vmax = 10, 90
1478+
1479+
1480+
def test_make_norm_from_scale_name():
1481+
logitnorm = mcolors.make_norm_from_scale(
1482+
mscale.LogitScale, mcolors.Normalize)
1483+
assert logitnorm.__name__ == "LogitScaleNorm"

0 commit comments

Comments
 (0)