Skip to content

Commit

Permalink
fix call to Ellipse, plus some formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Dec 4, 2023
1 parent 6f89bd8 commit 6f365b3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions python/gtsam/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import gtsam
from gtsam import Marginals, Point2, Point3, Pose2, Pose3, Values

# For translation between a scaling of the uncertainty ellipse and the
# percentage of inliers see discussion in
# For translation between a scaling of the uncertainty ellipse and the
# percentage of inliers see discussion in
# [PR 1067](https://github.com/borglab/gtsam/pull/1067)
# and the notebook python/gtsam/notebooks/ellipses.ipynb (needs scipy).
#
Expand All @@ -32,6 +32,7 @@
# 2D 39.34693 86.46647 98.88910 99.96645 99.99963
# 3D 19.87480 73.85359 97.07091 99.88660 99.99846


def set_axes_equal(fignum: int) -> None:
"""
Make axes of 3D plot have equal scale so that spheres appear as spheres,
Expand Down Expand Up @@ -127,8 +128,7 @@ def plot_covariance_ellipse_3d(axes,
axes.plot_surface(x, y, z, alpha=alpha, cmap='hot')


def plot_covariance_ellipse_2d(axes,
origin: Point2,
def plot_covariance_ellipse_2d(axes, origin: Point2,
covariance: np.ndarray) -> None:
"""
Plots a Gaussian as an uncertainty ellipse
Expand All @@ -154,7 +154,7 @@ def plot_covariance_ellipse_2d(axes,
e1 = patches.Ellipse(origin,
np.sqrt(w[0]) * 2 * k,
np.sqrt(w[1]) * 2 * k,
np.rad2deg(angle),
angle=np.rad2deg(angle),
fill=False)
axes.add_patch(e1)

Expand All @@ -180,12 +180,13 @@ def plot_point2_on_axes(axes,
if P is not None:
plot_covariance_ellipse_2d(axes, point, P)


def plot_point2(
fignum: int,
point: Point2,
linespec: str,
P: np.ndarray = None,
axis_labels: Iterable[str] = ("X axis", "Y axis"),
fignum: int,
point: Point2,
linespec: str,
P: np.ndarray = None,
axis_labels: Iterable[str] = ("X axis", "Y axis"),
) -> plt.Figure:
"""
Plot a 2D point on given figure with given `linespec`.
Expand Down

0 comments on commit 6f365b3

Please sign in to comment.