From 598c989ba92c5654a0ed5cb0099aac23b5631413 Mon Sep 17 00:00:00 2001 From: Gabriel Madeira Date: Thu, 1 Jun 2023 19:08:27 -0300 Subject: [PATCH 1/3] added raise condition and grouped Tick constructor parameters --- lib/matplotlib/axis.py | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 658171ef2fc9..747b08f0c3d4 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -57,25 +57,12 @@ class Tick(martist.Artist): """ def __init__( self, axes, loc, *, - size=None, # points - width=None, - color=None, - tickdir=None, - pad=None, - labelsize=None, - labelcolor=None, - zorder=None, - gridOn=None, # defaults to axes.grid depending on axes.grid.which - tick1On=True, - tick2On=True, - label1On=True, - label2On=False, - major=True, - labelrotation=0, - grid_color=None, - grid_linestyle=None, - grid_linewidth=None, - grid_alpha=None, + size=None, width=None, color=None, major=True, pad=None, zorder=None, # global + tickdir=None, tick1On=True, tick2On=True, # tick prop + labelsize=None, labelcolor=None, labelrotation=0, # label prop + label1On=True, label2On=False, # label prop + grid_color=None, grid_linestyle=None, grid_linewidth=None, # grid prop + grid_alpha=None, gridOn=None, # grid prop **kwargs, # Other Line2D kwargs applied to gridlines. ): """ @@ -153,6 +140,11 @@ def __init__( grid_alpha = mpl.rcParams["grid.alpha"] grid_kw = {k[5:]: v for k, v in kwargs.items()} + remaining_kwargs = { + k: v for k, v in kwargs.items() if not k.startswith('grid_')} + if remaining_kwargs: + raise ValueError(f"Invalid kwargs: {remaining_kwargs.keys()}") + self.tick1line = mlines.Line2D( [], [], color=color, linestyle="none", zorder=zorder, visible=tick1On, From 17e93519c401f69cf24cb2c905a54a3f420c75e1 Mon Sep 17 00:00:00 2001 From: Gabriel Madeira Date: Thu, 1 Jun 2023 19:38:47 -0300 Subject: [PATCH 2/3] fixed missing parameter --- lib/matplotlib/axis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 747b08f0c3d4..4d53ba201409 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -60,7 +60,7 @@ def __init__( size=None, width=None, color=None, major=True, pad=None, zorder=None, # global tickdir=None, tick1On=True, tick2On=True, # tick prop labelsize=None, labelcolor=None, labelrotation=0, # label prop - label1On=True, label2On=False, # label prop + labelfontfamily=None, label1On=True, label2On=False, # label prop grid_color=None, grid_linestyle=None, grid_linewidth=None, # grid prop grid_alpha=None, gridOn=None, # grid prop **kwargs, # Other Line2D kwargs applied to gridlines. From ad0a71be1bbecf6f77ee555a30e43418230d7493 Mon Sep 17 00:00:00 2001 From: Gabriel Madeira Date: Sat, 3 Jun 2023 00:19:54 -0300 Subject: [PATCH 3/3] changed raise() to warn() for invalid kwargs --- lib/matplotlib/axis.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 4f7740b7b2d0..b48f034e71a6 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -5,6 +5,7 @@ import datetime import functools import logging +import warnings from numbers import Real import numpy as np @@ -143,7 +144,9 @@ def __init__( remaining_kwargs = { k: v for k, v in kwargs.items() if not k.startswith('grid_')} if remaining_kwargs: - raise ValueError(f"Invalid kwargs: {remaining_kwargs.keys()}") + warnings.warn( + f"Invalid kwargs (not starting with 'grid_'):{remaining_kwargs.keys()}" + ) self.tick1line = mlines.Line2D( [], [], pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy