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

Skip to content

Commit 12c9d66

Browse files
Add unregister_scale() function to matplotlib.scale
Added unregister_scale(name) function that allows users to remove previously registered custom scales from the registry. Raises ValueError if the scale name is not found.
1 parent ee63e75 commit 12c9d66

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lib/matplotlib/scale.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,19 @@ def register_scale(scale_class):
955955
pending=True,
956956
)
957957

958+
def unregister_scale(name):
959+
"""
960+
Remove a custom scale from the registry.
961+
962+
Parameters
963+
----------
964+
name : str
965+
The name of the scale to remove.
966+
"""
967+
if name not in _scale_mapping:
968+
raise ValueError(f"Scale '{name}' is not registered.")
969+
del _scale_mapping[name]
970+
958971

959972
def _get_scale_docs():
960973
"""

0 commit comments

Comments
 (0)