Summary
Currently, the Tick constructor smashes together kwargs specific to it, kwargs for the tickmarkers, for the labels, and for the gridline:
def __init__(
self, axes, loc, *, # global
size=None, # tickmarker property
width=None, # tickmarker property
color=None, # global
tickdir=None, # tickmarker (not a property)
pad=None, # global
labelsize=None, # label property
labelcolor=None, # label property
labelfontfamily=None, # label property
zorder=None, # global
gridOn=None, # gridline (property: ~visible)
tick1On=True, # tick (property, but specific to each tick)
tick2On=True, # tick (property, but specific to each tick)
label1On=True, # label (property, but specific to each label)
label2On=False, # label (property, but specific to each label)
major=True, # global
labelrotation=0, # label property
grid_color=None, # grid property
grid_linestyle=None, # grid property
grid_linewidth=None, # grid property
grid_alpha=None, # grid property
**kwargs, # grid properties
):
The remaining kwargs are implicitly assumed to all start with "grid_" and further interpreted as grid properties (via grid_kw = {k[5:]: v for k, v in kwargs.items()}) -- note that this prefix is internally added by Axis.grid() to kwargs passed to it.
Proposed fix
We should at least check whether remaining kwargs indeed start with "grid_" and error out if that's not the case (Probably few people actually manually construct Ticks, but Tick(abcdecolor="k")) should certainly not be interpreted as Tick(grid_color="k") anyways.)
It may make sense to try to group the kwargs a bit more and not try to repeat all relevant properties in the Tick constructor, e.g. (not writing out the defaults)
def __init__(
self, axes, loc, *,
major, tickdir, pad, color, zorder, # global
tick_props, tick1On, tick2On, # tick properties
label_props, label1On, label2On, # label properties
grid_props, # grid properties
):
(probably kwargs could be normalized in this form as soon as one populates Axis._major_tick_kw/_minor_tick_kw)
Inspired by #25910.
Summary
Currently, the Tick constructor smashes together kwargs specific to it, kwargs for the tickmarkers, for the labels, and for the gridline:
The remaining kwargs are implicitly assumed to all start with "grid_" and further interpreted as grid properties (via
grid_kw = {k[5:]: v for k, v in kwargs.items()}) -- note that this prefix is internally added byAxis.grid()to kwargs passed to it.Proposed fix
We should at least check whether remaining kwargs indeed start with "grid_" and error out if that's not the case (Probably few people actually manually construct Ticks, but Tick(abcdecolor="k")) should certainly not be interpreted as Tick(grid_color="k") anyways.)
It may make sense to try to group the kwargs a bit more and not try to repeat all relevant properties in the Tick constructor, e.g. (not writing out the defaults)
(probably kwargs could be normalized in this form as soon as one populates Axis._major_tick_kw/_minor_tick_kw)
Inspired by #25910.