aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJ08nY2018-03-28 14:30:08 +0200
committerJ08nY2018-03-28 14:30:08 +0200
commite2b6a298522e6206903dcd0a0455431fb647d5d4 (patch)
tree09ed2b071b88de58f73e3d4288f43c8eabd01bfe /util
parent054f9f61f59a7b20ba835abb98d57a9746cafa86 (diff)
downloadECTester-e2b6a298522e6206903dcd0a0455431fb647d5d4.tar.gz
ECTester-e2b6a298522e6206903dcd0a0455431fb647d5d4.tar.zst
ECTester-e2b6a298522e6206903dcd0a0455431fb647d5d4.zip
Fix utility scripts adding a subtitle.
Diffstat (limited to 'util')
-rwxr-xr-xutil/plot_dh.py11
-rwxr-xr-xutil/plot_gen.py11
2 files changed, 18 insertions, 4 deletions
diff --git a/util/plot_dh.py b/util/plot_dh.py
index 55e11b3..33fc3eb 100755
--- a/util/plot_dh.py
+++ b/util/plot_dh.py
@@ -22,6 +22,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Plot ECTester ECDH timing.")
parser.add_argument("-o", "--output", dest="output", type=argparse.FileType("wb"), help="Write image to [file], do not display.", metavar="file")
parser.add_argument("--skip-first", dest="skip_first", action="store_true", help="Skip first entry, as it's usually a large outlier.")
+ parser.add_argument("-t", "--title", dest="title", nargs="?", default="", type=str, help="What title to give the figure.")
parser.add_argument("file", type=str, help="The file to plot(csv).")
opts = parser.parse_args()
@@ -48,8 +49,14 @@ if __name__ == "__main__":
plt.style.use("ggplot")
fig = plt.figure()
- fig.tight_layout(rect=[0, 0.02, 1, 0.98])
- fig.suptitle(opts.file)
+ layout_kwargs = {}
+ if opts.title is None:
+ fig.suptitle(opts.file)
+ layout_kwargs["rect"] = [0, 0.02, 1, 0.98]
+ elif opts.title:
+ fig.suptitle(opts.title)
+ layout_kwargs["rect"] = [0, 0.02, 1, 0.98]
+ fig.tight_layout(**layout_kwargs)
axe_hist = fig.add_subplot(2,1,1)
time_max = max(time_data)
diff --git a/util/plot_gen.py b/util/plot_gen.py
index f24fd2c..c37d7c2 100755
--- a/util/plot_gen.py
+++ b/util/plot_gen.py
@@ -27,6 +27,7 @@ if __name__ == "__main__":
parser.add_argument("--hist", dest="hist", action="store_true", help="Show histogram.")
parser.add_argument("--hw-hist", dest="hw_hist", action="store_true", help="Show Hamming weight 2D histogram (private key Hamming weight and generation time).")
parser.add_argument("--skip-first", dest="skip_first", action="store_true", help="Skip first entry, as it's usually a large outlier.")
+ parser.add_argument("-t", "--title", dest="title", type=str, nargs="?", default="", help="What title to give the figure.")
parser.add_argument("file", type=str, help="The file to plot(csv).")
opts = parser.parse_args()
@@ -58,8 +59,14 @@ if __name__ == "__main__":
plt.style.use("ggplot")
fig = plt.figure()
- fig.tight_layout(rect=[0, 0.02, 1, 0.98])
- fig.suptitle(opts.file)
+ layout_kwargs = {}
+ if opts.title is None:
+ fig.suptitle(opts.file)
+ layout_kwargs["rect"] = [0, 0.02, 1, 0.98]
+ elif opts.title:
+ fig.suptitle(opts.title)
+ layout_kwargs["rect"] = [0, 0.02, 1, 0.98]
+ fig.tight_layout(**layout_kwargs)
plot_i = 1
if plots[0]: