#!/usr/bin/env gnuplot ## SPDX-License-Identifier: CC0-1.0 ## ## Copyright (C) 2025 Woj. Kosior if (!exists("stats_filename")) stats_filename = "tree-size-stats.csv"; if (!exists("omit_breaking_changes")) omit_breaking_changes = 0; if (!exists("out_filename")) out_filename = "tree-size-stats.svg"; set terminal svg size 800,485 font "DejaVu,sans,14.5"; set output out_filename; #set title "Dependency tree sizes of rebuilt npm Registry packages"; set ylabel "Dependency count"; set datafile separator ","; bw = 0.9; # box width bg = 0.6; # box gap bs = 2 * bw + bg; # box span psh = 0.15; # point shift set boxwidth bw; set style fill solid border -1; set key noautotitle invert; #set xtics rotate by 30 right; set xtics rotate by 11 right scale 0; set bmargin 4.5; set lmargin 11; set rmargin 3.5; set linetype 1 linecolor rgb "0x555555"; set linetype 2 linecolor rgb "0x777777"; set linetype 3 linecolor rgb "0x111111" pt 0; set linetype 4 linecolor rgb "0x111111"; unset pointintervalbox; stats "tree-sizes.csv" using "TREE-VERS" nooutput; lbl_shift = -(STATS_max / 25); ytic_max = 200 * (1 + floor(STATS_max / 200)); set ytics 0, 200; do for [i=1:ytic_max/200] { set ytics add (i * 200); } set xrange [(-0.5 * (bg + bw)):(4 * bs - 0.5 * (bg + bw))]; set yrange [2*lbl_shift:ytic_max]; plot for [i=1:0:-1] stats_filename \ using (($0 - 1) * bs + i * bw):\ (column(i == 0 ? "VERS-AVG" : "DEPS-AVG")) \ with boxes \ title (i == 0 ? "All dependency package versions" : \ "All dependency packages (version-agnostic)"), \ for [i=0:1] "" \ using (($0 - 1) * bs + i * bw):\ (lbl_shift):\ (stringcolumn(i == 0 ? "VERS-AVG" : "DEPS-AVG")) \ with labels, \ for [i=0:1] "" \ using (($0 - 1) * bs + i * bw):\ (column(i == 0 ? "VERS-AVG" : "DEPS-AVG")):\ (column(i == 0 ? "VERS-STD_DEV" : "DEPS-STD_DEV")) \ with yerrorbars lt 3, \ "" \ using ($0 * bs + 0.5 * bw):\ "VERS-AVG":\ (""):\ xtic(stringcolumn("DESCRIPTION")) \ with labels, \ for [i=15:0:-1] "tree-sizes.csv" \ using (omit_breaking_changes && column("BREAKING-CHANGES") == 1 ? \ 1 / 0 : \ column("IN-DEBIAN") == i % 2 ? \ (i / 4) * bs + i % 4 / 2 * bw + (i % 2 * 2 - 1) * psh : \ 1 / 0):\ (column((i / 4 == 0 ? "TREE-" : \ i / 4 == 1 ? "TREE-MIN-" : \ i / 4 == 2 ? "TREE-DUMMY-" : \ "TREE-FLAT-") \ . \ (i % 4 / 2 == 0 ? "VERS" : "DEPS"))) \ with points lc 4 pt (i % 2 == 0 ? 6 : 7) ps 0.5 \ title (i == 0 ? "Absent in Debian" : \ i == 1 ? "Packaged in Debian" : \ "");