plotting#

Plotting utilities.

freeride.plotting.textbook_axes(ax: matplotlib.pyplot.Axes | None = None) matplotlib.pyplot.Axes[source]#

Creates textbook-style axes.

This function adjusts the properties of the given matplotlib axes object to create textbook-style axes where the left and bottom spines are positioned at the origin, and the top and right spines are removed.

Parameters:
  • (matplotlib.axes._axes.Axes (ax) – If not provided, the current axes (plt.gca()) will be used.

  • optional) (The matplotlib axis to modify.) – If not provided, the current axes (plt.gca()) will be used.

Return type:

The modified axes object.

Example

To create textbook-style axes on the current plot:

>>> import matplotlib.pyplot as plt
>>> plt.plot([0,1], [-1,0])
>>> textbook_axes()
freeride.plotting.update_axes_limits(ax: matplotlib.pyplot.Axes | None = None) matplotlib.pyplot.Axes[source]#

Recalculate limits and ensure the origin is visible.