Source code for suboptimumg.plotting.types

from enum import Enum

from matplotlib.patches import Arc
from matplotlib.path import Path


[docs] class NewArc(Arc): def __init__( self, xy: tuple[float, float], width: float, height: float, angle: float = 0.0, theta1: float = 0.0, theta2: float = 360.0, n: int = 30, **kwargs, ) -> None: """ Override of matplotlib Arc to allow customization of the number of interpolation points. Parameters ---------- xy : tuple[float, float] Center of the arc width : float Width of the arc height : float Height of the arc angle : float, optional Rotation of the arc ellipse in degrees theta1 : float, optional Start angle in degrees theta2 : float, optional End angle in degrees n : int, optional Number of points used to approximate the arc (smoother with more points) **kwargs Additional keyword arguments passed to Arc Notes ----- ``_theta_stretch`` is a private method matplotlib uses internally to compute the stretched arc parameters; it exists at runtime but is not part of matplotlib's public type stubs, hence the ignore below. """ fill = kwargs.setdefault("fill", False) if fill: raise ValueError("Arc objects cannot be filled") super().__init__(xy, width, height, angle=angle, **kwargs) self.theta1 = theta1 self.theta2 = theta2 ( self._theta1, self._theta2, self._stretched_width, self._stretched_height, ) = self._theta_stretch() # type: ignore[attr-defined] self._path = Path.arc(self._theta1, self._theta2, n=n)
[docs] class Axis(Enum): DISTANCE = "Distance (m)" TIME = "Time (s)"
[docs] class Metric(Enum): VELOCITY = "lap_vels" ACCEL = "lap_accs" POWER = "lap_powers"