(self, show_axes=True, ax=None, **kwargs)
| 127 | ) <= 1 + tol |
| 128 | |
| 129 | def draw(self, show_axes=True, ax=None, **kwargs): |
| 130 | import matplotlib.pyplot as plt |
| 131 | from matplotlib.lines import Line2D |
| 132 | from matplotlib.transforms import Affine2D |
| 133 | |
| 134 | if ax is None: |
| 135 | ax = plt.subplot(111, aspect="equal") |
| 136 | el = patches.Ellipse( |
| 137 | xy=(self.x, self.y), |
| 138 | width=self.width, |
| 139 | height=self.height, |
| 140 | angle=np.rad2deg(self.theta), |
| 141 | **kwargs, |
| 142 | ) |
| 143 | ax.add_patch(el) |
| 144 | if show_axes: |
| 145 | major = Line2D([-self.width / 2, self.width / 2], [0, 0], lw=3, zorder=3) |
| 146 | minor = Line2D([0, 0], [-self.height / 2, self.height / 2], lw=3, zorder=3) |
| 147 | trans = Affine2D().rotate(self.theta).translate(self.x, self.y) + ax.transData |
| 148 | major.set_transform(trans) |
| 149 | minor.set_transform(trans) |
| 150 | ax.add_artist(major) |
| 151 | ax.add_artist(minor) |
| 152 | |
| 153 | |
| 154 | class EllipseFitter: |
no test coverage detected