]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/commitdiff
Add plot psp result script
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 14 Feb 2020 13:36:02 +0000 (14:36 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Wed, 26 Feb 2020 15:51:30 +0000 (16:51 +0100)
scripts/plot_psp.py [new file with mode: 0644]

diff --git a/scripts/plot_psp.py b/scripts/plot_psp.py
new file mode 100644 (file)
index 0000000..79adcc7
--- /dev/null
@@ -0,0 +1,78 @@
+"""Plot psp results."""
+import matplotlib.pyplot as plt
+
+def plot_graph():
+    plt.rcParams["font.size"] = 24
+    #plt.rcParams["font.family"] = "TeX Gyre Pagella"
+    f, ax = plt.subplots()
+    ax.set_title(TITLE)
+
+    if GRID:
+        ax.minorticks_on()
+        ax.grid(which="major", linestyle="-", linewidth="0.1", color="gray")
+        #ax.grid(which="minor", linestyle=":", linewidth="0.1", color="gray")
+    if YLOG:
+        ax.set_yscale("log")
+
+    ax.set_xlabel(XLABEL)
+    ax.set_ylabel(YLABEL)
+
+    for i in PLOT:
+        plt.plot(i[0], i[1])
+
+    plt.legend(LEGEND)
+    plt.savefig(FILE, bbox_inches="tight")
+    plt.close()
+
+# cusp
+TITLE = "Number of direction changes"
+XLABEL = "Slot length minus car length [m]"
+YLABEL = "Number of changes [-]"
+LEGEND = [
+    "Reversed approach",
+    "Breadth-first search",
+]
+FILE = "/home/jiri/phd/pub/figs/psp_cusp.eps"
+GRID = True
+YLOG = False
+
+PLOT = []
+PLOT.append([
+    [0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7],
+    [18, 8, 6, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0],
+])
+PLOT.append([
+    [0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7],
+    [20, 8, 5, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0],
+])
+plot_graph()
+
+# time
+TITLE = "Elapsed time of search"
+XLABEL = "Slot length minus car length [m]"
+YLABEL = "Elapsed time [s]"
+LEGEND = [
+    "Reversed approach",
+    "Breadth-first search",
+]
+FILE = "/home/jiri/phd/pub/figs/psp_log_time.eps"
+GRID = False
+YLOG = True
+
+PLOT = []
+PLOT.append([
+    [0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7],
+    [0.000188779, 0.000169099, 0.000171329, 0.000163953, 0.000164034,
+    0.00015062, 0.000156396, 0.000162544, 0.000169836, 0.000178857,
+    0.000189283, 0.000167157, 0.00014392, 0.000127497],
+
+])
+PLOT.append([
+    [0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7],
+    [0.0536272, 0.0362204, 0.0328787, 0.0316327, 0.0300563, 0.0278359,
+    0.0278474, 0.0278955, 0.0248918, 0.0247431, 0.0245795, 0.0201776,
+    0.0176046, 0.0176267],
+
+])
+
+plot_graph()