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: object

Immutable 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.LayoutError before 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().