From 726554325f375bc2cf2ed95be1990a51ed2a541e Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 1 Nov 2021 16:21:08 +0100 Subject: [PATCH] Update psp plot with recent results --- scripts/plot_psp.py | 196 +++++++++++++++++++++++++++++++++----------- 1 file changed, 146 insertions(+), 50 deletions(-) diff --git a/scripts/plot_psp.py b/scripts/plot_psp.py index 37d4dd0..eed42fc 100644 --- a/scripts/plot_psp.py +++ b/scripts/plot_psp.py @@ -1,17 +1,143 @@ """Plot psp results.""" import matplotlib.pyplot as plt +RESULTS = [ +[4.210000,10,10], +[4.220000,10,9], +[4.230000,9,9], +[4.240000,8,8], +[4.250000,8,8], +[4.260000,8,7], +[4.270000,8,7], +[4.280000,7,7], +[4.290000,6,6], +[4.300000,6,6], +[4.310000,6,6], +[4.320000,6,6], +[4.330000,6,5], +[4.340000,6,5], +[4.350000,6,5], +[4.360000,5,5], +[4.370000,5,5], +[4.380000,4,4], +[4.390000,4,4], +[4.400000,4,4], +[4.410000,4,4], +[4.420000,4,4], +[4.430000,4,4], +[4.440000,4,4], +[4.450000,4,4], +[4.460000,4,3], +[4.470000,4,3], +[4.480000,4,3], +[4.490000,4,3], +[4.500000,4,3], +[4.510000,4,3], +[4.520000,4,3], +[4.530000,4,3], +[4.540000,3,3], +[4.550000,3,3], +[4.560000,3,2], +[4.570000,3,2], +[4.580000,2,2], +[4.590000,2,2], +[4.600000,2,2], +[4.610000,2,2], +[4.620000,2,2], +[4.630000,2,2], +[4.640000,2,2], +[4.650000,2,2], +[4.660000,2,2], +[4.670000,2,2], +[4.680000,2,2], +[4.690000,2,2], +[4.700000,2,2], +[4.710000,2,2], +[4.720000,2,2], +[4.730000,2,2], +[4.740000,2,2], +[4.750000,2,2], +[4.760000,2,2], +[4.770000,2,2], +[4.780000,2,2], +[4.790000,2,2], +[4.800000,2,2], +[4.810000,2,2], +[4.820000,2,1], +[4.830000,2,1], +[4.840000,2,1], +[4.850000,2,1], +[4.860000,2,1], +[4.870000,2,1], +[4.880000,2,1], +[4.890000,2,1], +[4.900000,2,1], +[4.910000,2,1], +[4.920000,2,1], +[4.930000,2,1], +[4.940000,2,1], +[4.950000,2,1], +[4.960000,2,1], +[4.970000,2,1], +[4.980000,2,1], +[4.990000,2,1], +[5.000000,2,1], +[5.010000,2,1], +[5.020000,2,1], +[5.030000,2,1], +[5.040000,2,1], +[5.050000,2,1], +[5.060000,2,1], +[5.070000,2,1], +[5.080000,2,1], +[5.090000,2,1], +[5.100000,2,1], +[5.110000,2,1], +[5.120000,2,1], +[5.130000,2,1], +[5.140000,2,1], +[5.150000,2,1], +[5.160000,1,1], +[5.170000,1,1], +[5.180000,1,1], +[5.190000,1,1], +[5.200000,1,1], +[5.210000,1,1], +[5.220000,1,1], +[5.230000,1,0], +[5.240000,1,0], +[5.250000,1,0], +[5.260000,1,0], +[5.270000,1,0], +[5.280000,1,0], +[5.290000,1,0], +[5.300000,1,0], +[5.310000,1,0], +[5.320000,1,0], +[5.330000,1,0], +[5.340000,1,0], +[5.350000,1,0], +[5.360000,1,0], +[5.370000,1,0], +[5.380000,1,0], +[5.390000,1,0], +[5.400000,1,0], +[5.410000,1,0], +[5.420000,0,0], +] + def plot_graph(): + plt.rcParams["font.family"] = "cmr10" plt.rcParams["font.size"] = 22 - plt.rcParams["font.family"] = "sans-serif" - plt.rcParams["figure.figsize"] = [6, 4] + plt.rcParams['lines.linewidth'] = 2.0 + plt.rcParams["figure.figsize"] = [12, 5] 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") + ax.grid(which="major", linestyle="-", linewidth="0.5", color="gray") + ax.grid(which="minor", linestyle=":", linewidth="0.5", color="gray") if YLOG: ax.set_yscale("log") if YLIM: @@ -21,67 +147,36 @@ def plot_graph(): ax.set_ylabel(YLABEL) for i in PLOT: - plt.plot(i[0], i[1]) + lstyle = "-" + lcolor = "blue" + if PLOT.index(i) == 0: + lstyle = "--" + lcolor = "orange" + plt.plot(i[0], i[1], linestyle=lstyle, color=lcolor) plt.legend(LEGEND) plt.savefig(FILE, bbox_inches="tight") plt.close() # cusp -TITLE = "Number of direction changes" -XLABEL = "Free space [m]" -YLABEL = "Number of changes [-]" +TITLE = "``Several reversed trials'' planner" +XLABEL = "Parking slot length [m]" +YLABEL = "Backward-forward changes [-]" LEGEND = [ - "Reversed", - "BFS", + "Naive guess for goal configuration", + "Goal configuration by in-slot planner", ] -FILE = "/home/jiri/phd/j1/figs/psp_cusp.eps" +FILE = "/home/jiri/phd/j1/figs/psp_cusp.pdf" GRID = True YLOG = False YLIM = False PLOT = [] -PLOT.append([ - [0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7], -# use ``for i in `cat stats | cut -d, -f2`; do echo $i,; done`` to generate -[ -16, -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,1.1,1.2,1.3,1.4,1.5,1.6,1.7], -[ -16, -8, -5, -3, -3, -2, -2, -1, -1, -1, -1, -0, -0, -0, -], -]) +PLOT.append([[i for (i, j, k) in RESULTS], [j for (i, j, k) in RESULTS]]) +PLOT.append([[i for (i, j, k) in RESULTS], [k for (i, j, k) in RESULTS]]) plot_graph() +""" SKIP # time TITLE = "Elapsed time of search" XLABEL = "Free space [m]" @@ -138,3 +233,4 @@ PLOT.append([ ]) plot_graph() +""" -- 2.39.2