gsplot.AxisSpec#
- class AxisSpec(*, xlabel=None, ylabel=None, xlim=None, ylim=None, xscale='linear', yscale='linear', xticks=None, yticks=None, xminor=None, yminor=None, xlabelpad=None, ylabelpad=None, xmargin=0.05, ymargin=0.05, top=None, bottom=None, left=None, right=None, direction=None)#
Bases:
objectImmutable Cartesian labels, limits, scales, ticks, and padding.
- Parameters:
xlabel (str | None) β Optional axis label strings.
ylabel (str | None) β Optional axis label strings.
xlim (tuple[float | str | None, float | str | None] | Sequence[float | str | None] | None) β Optional finite, unequal two-value limits.
ylim (tuple[float | str | None, float | str | None] | Sequence[float | str | None] | None) β Optional finite, unequal two-value limits.
xscale (Literal['linear', 'log', 'symlog', 'logit']) β One of
"linear","log","symlog", or"logit".yscale (Literal['linear', 'log', 'symlog', 'logit']) β One of
"linear","log","symlog", or"logit".xticks (tuple[float, ...] | None) β Optional finite tick locations.
yticks (tuple[float, ...] | None) β Optional finite tick locations.
xminor (bool | None) β Optional minor-tick enable flags.
yminor (bool | None) β Optional minor-tick enable flags.
xlabelpad (float | None) β Optional finite label padding values.
ylabelpad (float | None) β Optional finite label padding values.
xmargin (float) β Optional non-negative margin ratios for automatic endpoints.
ymargin (float) β Optional non-negative margin ratios for automatic endpoints.
top (bool | None) β Optional boolean flags for edge tick and label visibility.
bottom (bool | None) β Optional boolean flags for edge tick and label visibility.
left (bool | None) β Optional boolean flags for edge tick and label visibility.
right (bool | None) β Optional boolean flags for edge tick and label visibility.
direction (
Literal[``βinβ, ``'out','inout'] | None) β Optional tick direction:"in","out", or"inout".
Notes
Instances are frozen and normalize sequence inputs to tuples. Invalid values raise
gsplot.LayoutErrorbefore styling begins.Examples
>>> import gsplot as gs >>> spec = gs.AxisSpec(xlabel="time", xscale="linear", right=False) >>> spec.xlabel 'time' >>> spec.right False
- __init__(*, xlabel=None, ylabel=None, xlim=None, ylim=None, xscale='linear', yscale='linear', xticks=None, yticks=None, xminor=None, yminor=None, xlabelpad=None, ylabelpad=None, xmargin=0.05, ymargin=0.05, top=None, bottom=None, left=None, right=None, direction=None)#
- Parameters:
xlabel (str | None)
ylabel (str | None)
xlim (tuple[float | str | None, float | str | None] | Sequence[float | str | None] | None)
ylim (tuple[float | str | None, float | str | None] | Sequence[float | str | None] | None)
xscale (Literal['linear', 'log', 'symlog', 'logit'])
yscale (Literal['linear', 'log', 'symlog', 'logit'])
xticks (tuple[float, ...] | None)
yticks (tuple[float, ...] | None)
xminor (bool | None)
yminor (bool | None)
xlabelpad (float | None)
ylabelpad (float | None)
xmargin (float)
ymargin (float)
top (bool | None)
bottom (bool | None)
left (bool | None)
right (bool | None)
direction (Literal['in', 'out', 'inout'] | None)
- Return type:
None
Methods
__init_subclass__This method is called when a class is subclassed.
__new__(**kwargs)__subclasshook__Abstract classes can override this to customize issubclass().