]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blob - scripts/plot_psp.py
37d4dd0fdf3be30970f537f7e9b49fe8cd18a624
[hubacji1/iamcar2.git] / scripts / plot_psp.py
1 """Plot psp results."""
2 import matplotlib.pyplot as plt
3
4 def plot_graph():
5     plt.rcParams["font.size"] = 22
6     plt.rcParams["font.family"] = "sans-serif"
7     plt.rcParams["figure.figsize"] = [6, 4]
8     f, ax = plt.subplots()
9     ax.set_title(TITLE)
10
11     if GRID:
12         ax.minorticks_on()
13         ax.grid(which="major", linestyle="-", linewidth="0.1", color="gray")
14         #ax.grid(which="minor", linestyle=":", linewidth="0.1", color="gray")
15     if YLOG:
16         ax.set_yscale("log")
17     if YLIM:
18         ax.set_ylim(YLIM)
19
20     ax.set_xlabel(XLABEL)
21     ax.set_ylabel(YLABEL)
22
23     for i in PLOT:
24         plt.plot(i[0], i[1])
25
26     plt.legend(LEGEND)
27     plt.savefig(FILE, bbox_inches="tight")
28     plt.close()
29
30 # cusp
31 TITLE = "Number of direction changes"
32 XLABEL = "Free space [m]"
33 YLABEL = "Number of changes [-]"
34 LEGEND = [
35     "Reversed",
36     "BFS",
37 ]
38 FILE = "/home/jiri/phd/j1/figs/psp_cusp.eps"
39 GRID = True
40 YLOG = False
41 YLIM = False
42
43 PLOT = []
44 PLOT.append([
45     [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],
46 # use ``for i in `cat stats | cut -d, -f2`; do echo $i,; done`` to generate
47 [
48 16,
49 8,
50 6,
51 4,
52 4,
53 2,
54 2,
55 2,
56 2,
57 2,
58 2,
59 2,
60 2,
61 0,
62 ],
63 ])
64 PLOT.append([
65     [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],
66 [
67 16,
68 8,
69 5,
70 3,
71 3,
72 2,
73 2,
74 1,
75 1,
76 1,
77 1,
78 0,
79 0,
80 0,
81 ],
82 ])
83 plot_graph()
84
85 # time
86 TITLE = "Elapsed time of search"
87 XLABEL = "Free space [m]"
88 YLABEL = "Elapsed time [s]"
89 LEGEND = [
90     "Reversed",
91     "BFS",
92 ]
93 FILE = "/home/jiri/phd/j1/figs/psp_time.eps"
94 GRID = False
95 YLOG = False
96 YLIM = [0, 0.008]
97
98 PLOT = []
99 PLOT.append([
100     [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],
101 [
102 0.000265486,
103 0.000227139,
104 0.000185683,
105 0.000164569,
106 0.000159377,
107 0.000150449,
108 0.000156013,
109 0.000162367,
110 0.000170662,
111 0.000180358,
112 0.000190428,
113 0.000164781,
114 0.000143604,
115 0.000126686,
116 ],
117
118 ])
119 PLOT.append([
120     [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],
121 [
122 0.00744224,
123 0.00442855,
124 0.00324742,
125 0.00195541,
126 0.00177623,
127 0.0016829,
128 0.0016006,
129 0.0011417,
130 0.00106993,
131 0.00103785,
132 0.000948079,
133 0.00072849,
134 0.000691348,
135 0.000705111,
136 ],
137
138 ])
139
140 plot_graph()