Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import datetime
import functools
import logging
import warnings
from numbers import Real

import numpy as np
Expand Down Expand Up @@ -57,26 +58,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,
labelfontfamily=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
Copy link
Copy Markdown
Member

@timhoffm timhoffm Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size in points info must stay.

I'd have a slight preference to keep the one-parameter-per-line format and reorder in there:

# global
size=None,  # points
width=None,
...
# tick props
tickdir=None,
...

But that's personal taste and not a blocker.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree about the size in points comment staying.

tickdir=None, tick1On=True, tick2On=True, # tick prop
labelsize=None, labelcolor=None, labelrotation=0, # label prop
Comment thread
timhoffm marked this conversation as resolved.
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.
):
"""
Expand Down Expand Up @@ -154,6 +141,13 @@ 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:
warnings.warn(
f"Invalid kwargs (not starting with 'grid_'):{remaining_kwargs.keys()}"
)

self.tick1line = mlines.Line2D(
[], [],
color=color, linestyle="none", zorder=zorder, visible=tick1On,
Expand Down