From 882ed4afd5bb4fec5036aa54e259d67359ff5944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 9 Sep 2024 21:40:41 +0200 Subject: [PATCH] generate arrow structure on the fly rather than using a file --- test/data/height_frequency.arrow | Bin 1946 -> 0 bytes test/output/bigintNormalize.svg | 173 +++++++++++++++++++++++++++++++ test/plots/bigint.ts | 6 +- 3 files changed, 177 insertions(+), 2 deletions(-) delete mode 100644 test/data/height_frequency.arrow create mode 100644 test/output/bigintNormalize.svg diff --git a/test/data/height_frequency.arrow b/test/data/height_frequency.arrow deleted file mode 100644 index 82b5d9f96fb9e6770efe0db47ed2666e732c2c05..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1946 zcmd6oJxml)5XWcXI8H+J3IvP^LZSvsKPr>UJp2gSXtFsPdZ?H3)I|lk6N_@UGO$DEA4g1t4oI7RI5j&rb?^35 zxi3hj0(JWw;zmv`Md}kjFHwC;5o?G#HP^7ToHVt(w3(^9cV-@$r*kx>D+%lG^FB$Y ze(6(!UZ0gZb2KP@!(A94WP{S9G|D(BO`lf|-J;>SZK1u}mkKWy)V#lbdt8UM=hdK_%U5F^HMCG;KYg{ve%MxxZM`v{@&jWo`-Cw+_YaDBMY3%z$GrJXE#~T|4vhJj zPgut~>sV)<-@I0<^M+6?t=F;cI@aA_k5g)3{SEfGOAT-|z|jCl6C6!&G{MmXM-v=P za3tVJz>$C>0Y?Ik1RM!CQgEc;NWqbUBLznajutpt;AnxP1&$UtTHwgQk%1!vM+S}z z92q#sS)IvQUC7ycBWLv?XZ0s%bs}f)k(||wob3y8RyT6CKgiksh@90ga<)$*XZs{_ zw%;OW`y_IaZ4m#B>+Qe%5D(gkdBOMRhs5x?$QNlAR8JJOBPMhZIto1rJqo=5Jp;WA zeFD7--Gx4ezJu;SKS5t$p_}mg;lG9cMEoKE`2)_&cEAU@I=b>}Z@ILOtABWz8hWC9Q{s{C0bQn4S4d?A4 z_@RD5yAcolq2BxVN!TC22zYy{=ewrTGrCv)7kPiO7wv49llq**!+%F}e3hp5(O;?U Q-2cD-W8Y=HWB#A~2W)SH4gdfE diff --git a/test/output/bigintNormalize.svg b/test/output/bigintNormalize.svg new file mode 100644 index 0000000000..2d7b5e15b5 --- /dev/null +++ b/test/output/bigintNormalize.svg @@ -0,0 +1,173 @@ + + + + + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + + + ↑ height + + + + + 0.0 + 0.5 + 1.0 + 1.5 + 2.0 + 2.5 + 3.0 + 3.5 + 4.0 + 4.5 + 5.0 + + + frequency (%) → + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/bigint.ts b/test/plots/bigint.ts index 7ab876dac8..b50d02ed2f 100644 --- a/test/plots/bigint.ts +++ b/test/plots/bigint.ts @@ -28,11 +28,13 @@ export async function bigintStack() { } export async function bigintNormalize() { - const table = await Arrow.tableFromIPC(fetch("data/height_frequency.arrow")); + const heights = await d3.csv("data/athletes.csv").then((data) => data.map((d) => d.height)); + const table = Arrow.tableFromJSON( + d3.groups(heights, (d) => (d ? +d : NaN)).map(([height, {length}]) => ({height, frequency: BigInt(length)})) + ); return Plot.plot({ height: 500, x: {percent: true, grid: true}, - y: {domain: [1.3, 2.21]}, marks: [ Plot.ruleX([0]), Plot.ruleY(