Skip to content

plotting

Plotting utilities for RRA tools.

strip_axes(ax: Axes) -> Axes

Despine axis and remove ticks and labels.

Source code in src/rra_tools/plotting.py
def strip_axes(ax: Axes) -> Axes:
    """Despine axis and remove ticks and labels."""
    sns.despine(ax=ax, left=True, bottom=True)
    ax.set_xticks([])
    ax.set_yticks([])
    return ax

write_or_show(fig: Figure, plot_file: str | Path | None, **savefig_kwargs: Any) -> None

Write the figure to a file or show it.

Source code in src/rra_tools/plotting.py
def write_or_show(
    fig: Figure, plot_file: str | Path | None, **savefig_kwargs: Any
) -> None:
    """Write the figure to a file or show it."""
    if plot_file:
        fig.savefig(plot_file, **savefig_kwargs)
        plt.close(fig)
    else:
        plt.show()