chart = Plot.plot({
color: { legend: true },
marks: [
Plot.dot(scoresCombined, {
x: "PC1",
y: "PC2",
stroke: "season",
tip: true
}),
Plot.arrow(loadings, {x1: 0, x2: (d) => d.PC1 * scalingFactor, y1: 0, y2: (d) => d.PC2 * scalingFactor}),
Plot.text(loadings, {x: d => d.PC1 * scalingFactor * 1.1, y: d => d.PC2 * scalingFactor * 1.1, text: "Variable"})
]
})