Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
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,*,# globalsize=None,# tickmarker propertywidth=None,# tickmarker propertycolor=None,# globaltickdir=None,# tickmarker (not a property)pad=None,# globallabelsize=None,# label propertylabelcolor=None,# label propertylabelfontfamily=None,# label propertyzorder=None,# globalgridOn=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,# globallabelrotation=0,# label propertygrid_color=None,# grid propertygrid_linestyle=None,# grid propertygrid_linewidth=None,# grid propertygrid_alpha=None,# grid property**kwargs,# grid properties ):
The remaining kwargs are implicitly assumed to all start with "grid_" and further interpreted as grid properties (viagrid_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)
def__init__(self,axes,loc,*,major,tickdir,pad,color,zorder,# globaltick_props,tick1On,tick2On,# tick propertieslabel_props,label1On,label2On,# label propertiesgrid_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.