Public
Back
Version 33
6/18/2024
export async function beckerBarley() {
const Plot = await import("https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.14/+esm");
const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm");
const { document } = await import("https://cdn.jsdelivr.net/npm/linkedom@0.15/+esm").then((
{ parseHTML: p },
) => p(`<a>`));
const points = [
[0.6203908409346544, 5.300380222053028, "animal that barks"],
[-0.21262746845800742, 4.003038799146284, "dog"],
[-0.6873556434484371, 3.4054299858152337, "cat"],
[0.17327179783871047, 4.615590972757076, "animal"],
[1.033019581346729, 5.829842813936184, "woof woof woof"],
[4.828580005430798, -1.928937506969231, "man bites dog"],
[5.251272949211209, -2.35143131733336, "dog bites man"],
[-2.0660056361330765, -4.312333956683934, "discord bot"],
[-1.7140549740185353, -3.9600230782121573, "github api"],
[-2.534787916854827, -4.780896498681686, "chat server integration"],
];
const chart = Plot.plot({
document,
grid: true,
x: { domain: [-4, 6.5] },
marks: [
Plot.dot(points, { r: 0.5 }),
Plot.text(points, { text: (d) => d[2], dy: -3 }),
],
});
return new Response(
`${chart}`.replace(
/^<svg /,
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" ",
),
{ headers: { "Content-Type": "image/svg+xml" } },
);
}
janpaul123-semanticsearchblogpostplot.web.val.run
Updated: June 18, 2024