]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add percentiles and colors to gplot
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 9 Nov 2018 13:37:06 +0000 (14:37 +0100)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 9 Nov 2018 14:03:14 +0000 (15:03 +0100)
gplot.py

index a6a859609384bb019aa37e6070347898c8e5870a..b8c2f23ccb7eef07e8e73950770dbf243eb318dc 100644 (file)
--- a/gplot.py
+++ b/gplot.py
@@ -183,6 +183,10 @@ def plot_costdist():
             LOGSF[0]: "No path optimization",
             LOGSF[1]: "RRT*-Smart optimization",
             LOGSF[2]: "Dijkstra optimization"}
+    COLS={
+            LEG[LOGSF[0]]: "orange",
+            LEG[LOGSF[1]]: "blue",
+            LEG[LOGSF[2]]: "red"}
 
     r={}
     for sf in LOGSF:
@@ -200,10 +204,13 @@ def plot_costdist():
     ax.set_ylabel("Number of paths with given cost [-]")
     ax.set_xlabel("Path cost [m]")
     ax.set_yscale("log")
-    #ax.set_yticklabels([])
+    ax.set_aspect("equal")
 
     for a in r.keys():
-        plt.hist(v[a], alpha=0.5, label=a, bins=200)
+        plt.hist(v[a], alpha=0.5, label=a, bins=100, histtype="step",
+                color=COLS[a])
+        X_WHERE = np.percentile(v[a], [95])
+        plt.axvline(X_WHERE, lw=1, color=COLS[a], linestyle="--")
 
     plt.legend()
     plt.show()
@@ -216,6 +223,10 @@ def plot_maxtime():
             LOGSF[0]: "RRT* nearest neighbour",
             LOGSF[1]: "Nearest neighbour with same heading",
             LOGSF[2]: "Nearest neighbour Euclidean distance"}
+    COLS={
+            LEG[LOGSF[0]]: "orange",
+            LEG[LOGSF[1]]: "blue",
+            LEG[LOGSF[2]]: "red"}
 
     r={}
     for sf in LOGSF:
@@ -233,10 +244,13 @@ def plot_maxtime():
     ax.set_ylabel("Number of paths found [-]")
     ax.set_xlabel("Algorithm elapsed time [s]")
     ax.set_yscale("log")
-    #ax.set_yticklabels([])
+    ax.set_aspect("equal")
 
     for a in r.keys():
-        plt.hist(v[a], alpha=0.5, label=a, bins=np.arange(0, 10, 0.05))
+        plt.hist(v[a], alpha=0.5, label=a, bins=np.arange(0, 10, 0.1),
+                histtype="step", color=COLS[a])
+        X_WHERE = np.percentile(v[a], [95])
+        plt.axvline(X_WHERE, lw=1, color=COLS[a], linestyle="--")
 
     plt.legend()
     plt.show()