2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
6 See LICENSE for the license information
8 Script to plot City10000 results.
9 Can be used to plot results from both C++ and python scripts.
13 python plot_city10000.py ../../../examples/Data/ISAM2_GT_city10000.txt \
14 --estimates ../../../build/examples/ISAM2_city10000.txt \
15 ../../../build/examples/Hybrid_City10000.txt
18 NOTE: We can pass in as many estimates as we need,
19 though we also need to pass in the same number of --colors and --labels.
21 You can generate estimates by running
22 - `make ISAM2_City10000.run` for the ISAM2 version
23 - `make Hybrid_City10000.run` for the Hybrid Smoother version
31 from matplotlib
import pyplot
as plt
35 """Parse command line arguments"""
36 parser = argparse.ArgumentParser()
37 parser.add_argument(
"ground_truth", help=
"The ground truth data file.")
41 help=
"File(s) with estimates (as .txt), can be more than one.")
42 parser.add_argument(
"--labels",
44 help=
"Label to apply to the estimate graph.",
45 default=(
"ISAM2",
"Hybrid Factor Graphs"))
49 help=
"The color to apply to each of the estimate graphs.",
50 default=((0.9, 0.1, 0.1, 0.4), (0.1, 0.1, 0.9, 0.4)))
51 return parser.parse_args()
57 estimate_color=(0.1, 0.1, 0.9, 0.4),
58 estimate_label=
"Hybrid Factor Graphs"):
59 """Plot the City10000 estimates against the ground truth.
62 gt (np.ndarray): The ground truth trajectory as xy values.
63 estimates (np.ndarray): The estimates trajectory as xy values.
64 fignum (int): The figure number for multiple plots.
65 estimate_color (tuple, optional): The color to use for the graph of estimates.
66 Defaults to (0.1, 0.1, 0.9, 0.4).
67 estimate_label (str, optional): Label for the estimates, used in the legend.
68 Defaults to "Hybrid Factor Graphs".
70 fig = plt.figure(fignum)
73 ax.axis((-65.0, 65.0, -75.0, 60.0))
78 color=(0.1, 0.7, 0.1, 0.5),
80 ax.plot(estimates[:, 0],
92 gt = np.loadtxt(args.ground_truth, delimiter=
" ")
95 h_poses = np.loadtxt(args.estimates[i], delimiter=
" ")
100 estimate_color=args.colors[i],
101 estimate_label=args.labels[i])
106 if __name__ ==
"__main__":