# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/11_matplotlib.ipynb.

# %% auto 0
__all__ = ['unify_axis_fontsize', 'unify_axes_fontsize']

# %% ../nbs/11_matplotlib.ipynb 1
from matplotlib.pyplot import Axes
from typing import Iterable

# %% ../nbs/11_matplotlib.ipynb 2
def unify_axis_fontsize(ax: Axes, fontsize: str | float):
    mainlabels = [ax.title, ax.xaxis.label, ax.yaxis.label]
    ticklabels = ax.get_xticklabels() + ax.get_yticklabels()
    for text in mainlabels + ticklabels:
        text.set_fontsize(fontsize)

# %% ../nbs/11_matplotlib.ipynb 3
def unify_axes_fontsize(
    axes: Axes, # a single axis or a list of axes
    fontsize: str | float = "medium" # string values denote sizes relative to the default font size
):
    """
    Set the fontsize of all text elements in a matplotlib axis to the same value.
    """
    if not isinstance(axes, Iterable):
        axes = [axes]
    for ax in axes:
        unify_axis_fontsize(ax, fontsize)
