faninsar.plots.formatters.setup_phase_axis#

faninsar.plots.formatters.setup_phase_axis(axis: Axis, base: float = 0.5, denominator: int = 4, use_unicode: bool = True, latex: bool = False) None[source]#

Configure an axis for phase display with π-based ticks.

This is a convenience function to set up both the formatter and locator for a phase axis in one call.

Parameters:
  • axis (matplotlib.axis.Axis) – The axis to configure (e.g., ax.xaxis or ax.yaxis).

  • base (float, optional) – The base multiple of π for tick spacing. Default is 0.5 (π/2).

  • denominator (int, optional) – The maximum denominator for fraction simplification. Default is 4.

  • use_unicode (bool, optional) – Whether to use Unicode π symbol. Default is True.

  • latex (bool, optional) – Whether to format labels using LaTeX. Default is False.

Examples

>>> import matplotlib.pyplot as plt
>>> from faninsar.plots import setup_phase_axis
>>> fig, ax = plt.subplots()
>>> setup_phase_axis(ax.xaxis, base=0.5)
>>> ax.plot(
...     np.linspace(-np.pi, np.pi, 100), np.sin(np.linspace(-np.pi, np.pi, 100))
... )