From 4bd3943c13bc09248d87c378bbe4d3ea2c8a4a27 Mon Sep 17 00:00:00 2001
From: STEVAN Antoine <antoine.stevan@isae-supaero.fr>
Date: Fri, 5 Jul 2024 12:17:48 +0000
Subject: [PATCH] improve setup and commit plots (dragoon/komodo!152)

- show the log of the degree for high values
- don't show the "time" Y label because the units are in the times
  values
- don't rotate the X tick labels

## results
![setup](/uploads/75dfd2033801a88e446e0ce8cae24167/setup.png)
![commit](/uploads/cca5bdfabb8f4242d21bf68079a5566a/commit.png)
---
 benchmarks/.nushell/commit/plot.nu |  9 ++++++---
 benchmarks/.nushell/setup/plot.nu  | 11 +++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/benchmarks/.nushell/commit/plot.nu b/benchmarks/.nushell/commit/plot.nu
index 576b200f..4e0726e9 100644
--- a/benchmarks/.nushell/commit/plot.nu
+++ b/benchmarks/.nushell/commit/plot.nu
@@ -5,11 +5,12 @@ use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ]
 export def main [data: path, --save: path] {
     check-file $data --span (metadata $data).span
 
-    let graphs = open $data
+    let raw = open $data
         | where name !~ '^SEC'
         | ns-to-ms $.times
         | compute-stats $.times
         | insert degree { get label | parse "degree {d}" | into record | get d | into int }
+    let graphs = $raw
         | rename --column { degree: "x", mean: "y", stddev: "e" }
         | select name x y e
         | group-by name --to-table
@@ -19,11 +20,13 @@ export def main [data: path, --save: path] {
 
     let options = [
         # --title "time to create trusted setups for certain curves"
-        --x-label "degree"
-        --y-label "time (in ms)"
+        --x-label '$\log_2 d$'
+        # --y-label "time"
         ...($graphs.points | flatten | into-axis-options -x "plain" -y "duration")
         ...$COMMON_OPTIONS
         (if $save != null { [ --save $save ] })
+        --x-tick-labels ($raw.degree | uniq | math log 2)
+        --x-ticks-rotation 0
     ]
 
     gplt plot ($graphs | to json) ...($options | flatten | compact)
diff --git a/benchmarks/.nushell/setup/plot.nu b/benchmarks/.nushell/setup/plot.nu
index c0ff7b9f..44e86de7 100644
--- a/benchmarks/.nushell/setup/plot.nu
+++ b/benchmarks/.nushell/setup/plot.nu
@@ -5,16 +5,17 @@ use ../../../.nushell plot [ into-axis-options, COMMON_OPTIONS, gplt ]
 export def main [data: path, --save: path] {
     check-file $data --span (metadata $data).span
 
-    let graphs = open $data
+    let raw = open $data
         | ns-to-ms times
         | compute-stats times
-        | insert degree { get label | parse "degree {d}" | into record | get d | into int}
+        | insert degree { get label | parse "degree {d}" | into record | get d | into int }
         | update name {|it| if ($it.name | str starts-with  "ARK") {
             let c = $it.name | parse "ARK setup on {curve}" | into record | get curve
             $"($c)-ark"
         } else {
             $it.name | parse "setup on {curve}" | into record | get curve
         }}
+    let graphs = $raw
         | rename --column { degree: "x", mean: "y", stddev: "e" }
         | select name x y e
         | group-by name --to-table
@@ -24,11 +25,13 @@ export def main [data: path, --save: path] {
 
     let options = [
         # --title "time to create trusted setups for certain curves"
-        --x-label "degree"
-        --y-label "time (in ms)"
+        --x-label '$\log_2 d$'
+        # --y-label "time"
         ...($graphs.points | flatten | into-axis-options -x "plain" -y "duration")
         ...$COMMON_OPTIONS
         (if $save != null { [ --save $save ] })
+        --x-tick-labels ($raw.degree | uniq | math log 2)
+        --x-ticks-rotation 0
     ]
 
     gplt plot ($graphs | to json) ...($options | flatten | compact)
-- 
GitLab