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, width, height, angle=0.0, theta1=0.0, theta2=360.0, n=30, **kwargs ): """ Override of matplotlib Arc to allow customization of the number of interpolation points. Parameters ---------- xy : tuple 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 """ fill = kwargs.setdefault("fill", False) # Arc must not be filled if fill: raise ValueError("Arc objects cannot be filled") # Initialize base Arc class super().__init__(xy, width, height, angle=angle, **kwargs) self.theta1 = theta1 self.theta2 = theta2 # Compute stretched arc parameters ( self._theta1, self._theta2, self._stretched_width, self._stretched_height, ) = self._theta_stretch() # Generate path using specified number of interpolation points 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"