From 5365272e279e39e4058d3821f3f313bc91cd2716 Mon Sep 17 00:00:00 2001 From: haskal Date: Fri, 4 Dec 2020 20:45:47 -0500 Subject: [PATCH] sort plot labels by score --- scripts/plot | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/plot b/scripts/plot index b320d95..a7b4d13 100755 --- a/scripts/plot +++ b/scripts/plot @@ -97,9 +97,14 @@ (set-pts! mid now pts)) (plot-x-ticks (date-ticks)) -(plot (for/list ([(mid data) (in-hash point-tls)]) - (lines data - #:label (hash-ref member-names mid) +(define ordered-mids + (sort (hash-keys point-tls) + (lambda (a b) + (>= (get-last-pts (hash-ref point-tls a)) (get-last-pts (hash-ref point-tls b)))))) +(plot (for/list ([mid (in-list ordered-mids)]) + (lines (hash-ref point-tls mid) + #:label (format "~a (~a pts)" (hash-ref member-names mid) + (get-last-pts (hash-ref point-tls mid))) #:color mid #:style mid #:width 2))