Plot.plot({
width: 1200,
height: 330,
marginLeft: 60,
marginRight: 60,
marginTop: 80,
facet: {label: null},
color: {
type: "linear",
domain: [0, 15],
range: ["white", "gold"],
interpolate: d3.interpolateRgb.gamma(3.2),
legend: true,
label: "Sun hours"
},
y: {domain: [0, 1]},
marks: [
Plot.axisX({anchor: "top", fontSize: 18, ticks: seasons.map(d => d.middle), tickSize: 0, tickFormat: (d, i) => `${["🍂 Fall", "❄️ Winter", "🌱 Spring", "⛱️ Summer"][i]}`}),
Plot.axisX({anchor: "top", ticks: seasons.map(d => d.start), tickSize: -240, color: "lightgrey", tickFormat: []}),
Plot.axisX({anchor: "bottom", tickSize: 0, tickFormat: "%b%y"}),
Plot.ruleY(cloudyrows, {y: 0.8, x1: "start", x2: "end", fy: "name", strokeWidth: 4, stroke: "purple"}),
Plot.textY(cloudyrows, {y: 0.8, dy: -7, x: "start", text: "count", fy: "name", textAnchor: "start"}),
Plot.ruleX(citiessun, {
x: "date",
y: 0.7,
stroke: "sun",
strokeWidth: 2,
fy: "name",
tip: true,
title: (d) => d3.timeFormat("%d %B")(d.date) + "\n" + d.sun + 'h'
}),
Plot.ruleX(citiessun, Plot.pointerX({x: "date", y: 0.7, fy: "name", stroke: "purple"}))
]
})