Plot.plot({
height: 800,
marginLeft: 110,
grid: true,
x: {nice: true},
y: {inset: 5},
color: {scheme: "spectral", label: "Change in yield", tickFormat: "+f", legend: true},
facet: {marginRight: 90},
marks: [
Plot.frame(),
Plot.arrow(barley, Plot.groupY({
x1: "first",
x2: "last",
stroke: ([x1, x2]) => x2 - x1
}, {
x: "yield",
y: "variety",
fy: "site",
stroke: "yield",
strokeWidth: 2,
sort: {y: "x1", fy: "x1", reduce: "median", reverse: true}
}))
]
})