fix call to Ellipse, plus some formatting
parent
6f89bd8ddf
commit
6f365b330b
|
@ -12,8 +12,8 @@ from mpl_toolkits.mplot3d import Axes3D # pylint: disable=unused-import
|
||||||
import gtsam
|
import gtsam
|
||||||
from gtsam import Marginals, Point2, Point3, Pose2, Pose3, Values
|
from gtsam import Marginals, Point2, Point3, Pose2, Pose3, Values
|
||||||
|
|
||||||
# For translation between a scaling of the uncertainty ellipse and the
|
# For translation between a scaling of the uncertainty ellipse and the
|
||||||
# percentage of inliers see discussion in
|
# percentage of inliers see discussion in
|
||||||
# [PR 1067](https://github.com/borglab/gtsam/pull/1067)
|
# [PR 1067](https://github.com/borglab/gtsam/pull/1067)
|
||||||
# and the notebook python/gtsam/notebooks/ellipses.ipynb (needs scipy).
|
# and the notebook python/gtsam/notebooks/ellipses.ipynb (needs scipy).
|
||||||
#
|
#
|
||||||
|
@ -32,6 +32,7 @@ from gtsam import Marginals, Point2, Point3, Pose2, Pose3, Values
|
||||||
# 2D 39.34693 86.46647 98.88910 99.96645 99.99963
|
# 2D 39.34693 86.46647 98.88910 99.96645 99.99963
|
||||||
# 3D 19.87480 73.85359 97.07091 99.88660 99.99846
|
# 3D 19.87480 73.85359 97.07091 99.88660 99.99846
|
||||||
|
|
||||||
|
|
||||||
def set_axes_equal(fignum: int) -> None:
|
def set_axes_equal(fignum: int) -> None:
|
||||||
"""
|
"""
|
||||||
Make axes of 3D plot have equal scale so that spheres appear as spheres,
|
Make axes of 3D plot have equal scale so that spheres appear as spheres,
|
||||||
|
@ -127,8 +128,7 @@ def plot_covariance_ellipse_3d(axes,
|
||||||
axes.plot_surface(x, y, z, alpha=alpha, cmap='hot')
|
axes.plot_surface(x, y, z, alpha=alpha, cmap='hot')
|
||||||
|
|
||||||
|
|
||||||
def plot_covariance_ellipse_2d(axes,
|
def plot_covariance_ellipse_2d(axes, origin: Point2,
|
||||||
origin: Point2,
|
|
||||||
covariance: np.ndarray) -> None:
|
covariance: np.ndarray) -> None:
|
||||||
"""
|
"""
|
||||||
Plots a Gaussian as an uncertainty ellipse
|
Plots a Gaussian as an uncertainty ellipse
|
||||||
|
@ -154,7 +154,7 @@ def plot_covariance_ellipse_2d(axes,
|
||||||
e1 = patches.Ellipse(origin,
|
e1 = patches.Ellipse(origin,
|
||||||
np.sqrt(w[0]) * 2 * k,
|
np.sqrt(w[0]) * 2 * k,
|
||||||
np.sqrt(w[1]) * 2 * k,
|
np.sqrt(w[1]) * 2 * k,
|
||||||
np.rad2deg(angle),
|
angle=np.rad2deg(angle),
|
||||||
fill=False)
|
fill=False)
|
||||||
axes.add_patch(e1)
|
axes.add_patch(e1)
|
||||||
|
|
||||||
|
@ -180,12 +180,13 @@ def plot_point2_on_axes(axes,
|
||||||
if P is not None:
|
if P is not None:
|
||||||
plot_covariance_ellipse_2d(axes, point, P)
|
plot_covariance_ellipse_2d(axes, point, P)
|
||||||
|
|
||||||
|
|
||||||
def plot_point2(
|
def plot_point2(
|
||||||
fignum: int,
|
fignum: int,
|
||||||
point: Point2,
|
point: Point2,
|
||||||
linespec: str,
|
linespec: str,
|
||||||
P: np.ndarray = None,
|
P: np.ndarray = None,
|
||||||
axis_labels: Iterable[str] = ("X axis", "Y axis"),
|
axis_labels: Iterable[str] = ("X axis", "Y axis"),
|
||||||
) -> plt.Figure:
|
) -> plt.Figure:
|
||||||
"""
|
"""
|
||||||
Plot a 2D point on given figure with given `linespec`.
|
Plot a 2D point on given figure with given `linespec`.
|
||||||
|
|
Loading…
Reference in New Issue