dots = FileAttachment("data/ds_data_en.csv").csv({ typed: true})
plotConfig = ({
height: 520,
width: 760,
marginTop: 40,
marginLeft: 120,
marginRight: 60,
fontFamily: "Century Gothic",
style: {
fontSize: "15px",
fontFamily: "Century Gothic",
},
x: {
ticks: 0,
label: "flexibility →"
},
y: {
ticks: 0,
label: "↑ ease of use",
},
color: {
type: "identity"
},
marks: [
Plot.ruleX([0]),
Plot.ruleY([0]),
Plot.text(
[
{ x: 0.42, y: 0.42, quadrant: "Do not Use" },
{ x: 0.48, y: 0.48, quadrant: "Use" },
],
{
x: "x",
y: "y",
text: "quadrant",
textAnchor: "end",
fill: (d) => (d.quadrant === "Use" ? "#72bb6f" : "red"),
rotate: 36.6,
fontSize: 14,
fontFamily: "Century Gothic",
}
),
Plot.text(
[
{ x: 0, y: 0.8, quadrant: "intuitive &\nconcise" },
{ x: 0, y: 0.2, quadrant: "hard to learn &\nverbose" },
{ x: 0.2, y: -0.05, quadrant: "limited" },
{ x: 0.8, y: -0.05, quadrant: "powerful" }
],
{
x: "x",
y: "y",
text: "quadrant",
dx: -10,
textAnchor: "end",
fontSize: 15,
fontFamily: "Century Gothic"
}
),
Plot.areaX(
[
{ x: 0, y: 1 },
{ x: 0.1, y: 0.9 },
{ x: 0.7, y: 0.7 },
{ x: 0.9, y: 0.1 },
{ x: 1, y: 0 }
],
{ x: "x", y: "y", curve: "cardinal", fill: "lightgray", fillOpacity: 0.5 }
),
Plot.line(
[
{ x: 0, y: 0.665 },
{ x: 0.05, y: 0.685 },
{ x: 0.10, y: 0.665 },
{ x: 0.15, y: 0.685 },
{ x: 0.20, y: 0.665 },
{ x: 0.25, y: 0.685 },
{ x: 0.30, y: 0.665 },
{ x: 0.35, y: 0.685 },
{ x: 0.40, y: 0.665 },
{ x: 0.45, y: 0.685 },
{ x: 0.50, y: 0.665 },
{ x: 0.55, y: 0.685 },
{ x: 0.60, y: 0.665 },
{ x: 0.65, y: 0.685 },
{ x: 0.70, y: 0.665 },
{ x: 0.75, y: 0.685 },
{ x: 0.80, y: 0.665 },
{ x: 0.825, y: 0.675 },
],
{
x: "x",
y: "y",
curve: "cardinal",
strokeDasharray: 4,
stroke: "#559bd5",
}
),
Plot.text(
[
{ x: 0.84, y: 0.675, quadrant: "↓ Coding" },
],
{
x: "x",
y: "y",
text: "quadrant",
textAnchor: "start",
fontSize: 14,
fontFamily: "Century Gothic",
fill: "#559bd5",
}
),
Plot.dot(dots, {
x: "x",
y: "y",
stroke: (d) => (["ggplot2", "vega-lite", "Plot"].includes(d.vis) ? "#72bb6f" : "grey"),
href: (d) => `${d.url}`,
r: 4.5,
}),
Plot.text(dots, {
x: (d) =>
["Flourish", "Highcharts"].includes(d.vis)
? d.x - (d.vis.length / 65)
: ["Excel"].includes(d.vis)
? d.x - (d.vis.length / 65)
: ["ggplot2"].includes(d.vis)
? d.x - (d.vis.length / 55)
: d.x,
y: (d) =>
d.vis === "ggplot2"
? d.y - 0.00
: d.vis === "Excel"
? d.y - 0.05
: d.vis === "vega-lite"
? d.y + 0.00
: d.y,
text: "vis",
dx: 10,
textAnchor: "start",
fontSize: 14,
fontFamily: "Century Gothic",
fill: (d) => (["ggplot2", "vega-lite", "Plot"].includes(d.vis) ? "#72bb6f" : "grey"),
href: (d) => `${d.url}`,
}),
Plot.rect(
[
{ x1: 0.49, y1: 0.55, x2: 0.83, y2: 0.65}
],{
x1: "x1", // or ([x1]) => x1
y1: "y1", // or ([, y1]) => y1
x2: "x2", // or ([,, x2]) => x2
y2: "y2", // or ([,,, y2]) => y2
stroke: "#72bb6f",
strokeDasharray: 4,
}),
Plot.text(
[
{ x: 0.54, y: 0.52, quadrant: "Grammar of Graphics" },
],
{
x: "x",
y: "y",
text: "quadrant",
textAnchor: "start",
fontSize: 14,
fontFamily: "Century Gothic",
fill: "#72bb6f",
}
),
Plot.line(
[
{ x: 0, y: 0.9 },
{ x: 0.9, y: 0 }
],
{
x: "x",
y: "y",
stroke: "gray",
strokeDasharray: 4
}
),
Plot.tip(dots, Plot.pointer({
x: "x",
y: "y",
title: d => `${d.Vorteile}\n―――――――――――――――――――――――\n${d.Nachteile}`,
stroke: "transparent",
fontSize: 14,
lineWidth: 22
})),
]
})