]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Update plot
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 7 Jan 2019 14:35:00 +0000 (15:35 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 8 Jan 2019 12:28:04 +0000 (13:28 +0100)
Decide if there are some edges to plot and plot just one figure if not.

plot.py

diff --git a/plot.py b/plot.py
index ff42fb894c0b077f782119a19a67f9a6f54ac434..43f6ee8093c618140c3e2535007820246aeb0f5e 100644 (file)
--- a/plot.py
+++ b/plot.py
@@ -3,7 +3,7 @@
 from json import loads
 from math import copysign, cos, pi, sin
 from matplotlib import pyplot as plt
-from sys import argv
+from sys import argv, exit
 
 sign = lambda x: copysign(1, x)
 
@@ -142,7 +142,10 @@ if __name__ == "__main__":
     ################
     ## 1st subplot
 
-    ax = fig.add_subplot(121)
+    if "edge" in t.keys():
+        ax = fig.add_subplot(121)
+    else:
+        ax = fig.add_subplot(111)
     ax.set_aspect("equal")
     ax.set_title("Final path")
     ax.set_xlabel("x [m]")
@@ -239,6 +242,11 @@ if __name__ == "__main__":
 
     handles, labels = ax.get_legend_handles_labels()
 
+    if not "edge" in t.keys():
+        plt.show()
+        plt.close(fig)
+        exit(0)
+
     ################
     ## 2nd subplot