From: Jiri Hubacek Date: Fri, 9 Nov 2018 13:37:06 +0000 (+0100) Subject: Add percentiles and colors to gplot X-Git-Tag: v0.3.0~5 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/e758841504ca1bcf32a5fde8bfee29bbff496832 Add percentiles and colors to gplot --- diff --git a/gplot.py b/gplot.py index a6a8596..b8c2f23 100644 --- 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()