Skip to content

Commit

Permalink
Merge pull request #805 from tlsfuzzer/si-units
Browse files Browse the repository at this point in the history
make all graphs use SI prefixes for time
  • Loading branch information
tomato42 committed Feb 10, 2023
2 parents 7a7011a + 5aa0f9c commit 2426939
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions tlsfuzzer/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ def box_plot(self):
ax.set_xticklabels([''] + list(range(len(data.columns))))

ax.set_title("Box plot")
ax.set_ylabel("Time [s]")
ax.set_ylabel("Time")
ax.set_xlabel("Class index")

formatter = mpl.ticker.EngFormatter('s')
ax.get_yaxis().set_major_formatter(formatter)

canvas.print_figure(join(self.output, "box_plot.png"),
bbox_inches="tight")

Expand All @@ -388,10 +392,17 @@ def scatter_plot(self):
ax.plot(data, ".", fillstyle='none', alpha=0.6)

ax.set_title("Scatter plot")
ax.set_ylabel("Time [s]")
ax.set_ylabel("Time")
ax.set_xlabel("Sample index")

ax.set_yscale("log")

formatter = mpl.ticker.EngFormatter('s')
ax.get_yaxis().set_major_formatter(formatter)
ax.get_yaxis().set_minor_formatter(formatter)

self.make_legend(ax)

canvas.print_figure(join(self.output, "scatter_plot.png"),
bbox_inches="tight")
quant = np.quantile(data, [0.005, 0.95])
Expand Down Expand Up @@ -424,8 +435,12 @@ def diff_scatter_plot(self):
axes.plot(values, ".", fillstyle='none', alpha=0.6)

axes.set_title("Scatter plot of class differences")
axes.set_ylabel("Time [s]")
axes.set_ylabel("Time")
axes.set_xlabel("Sample index")

formatter = mpl.ticker.EngFormatter('s')
axes.get_yaxis().set_major_formatter(formatter)

axes.legend(values, ncol=6, loc='upper center',
bbox_to_anchor=(0.5, -0.15))
canvas.print_figure(join(self.output, "diff_scatter_plot.png"),
Expand All @@ -451,8 +466,12 @@ def ecdf_plot(self):
ax.step(sorted(values), levels, where='post')
self.make_legend(ax)
ax.set_title("Empirical Cumulative Distribution Function")
ax.set_xlabel("Time [s]")
ax.set_xlabel("Time")
ax.set_ylabel("Cumulative probability")

formatter = mpl.ticker.EngFormatter('s')
ax.get_xaxis().set_major_formatter(formatter)

canvas.print_figure(join(self.output, "ecdf_plot.png"),
bbox_inches="tight")
quant = np.quantile(values, [0.01, 0.95])
Expand Down Expand Up @@ -665,6 +684,9 @@ def conf_interval_plot(self):
ax.set_xlabel("Class pairs")
ax.set_ylabel("{0} of differences".format(name))

formatter = mpl.ticker.EngFormatter('s')
ax.get_yaxis().set_major_formatter(formatter)

if name == "trim mean (5%)":
name = "trim_mean_05"
elif name == "trim mean (25%)":
Expand Down

0 comments on commit 2426939

Please sign in to comment.