plot = Plot.plot({
width: width - 2 * 20,
height: 50 * yDomain.length,
insetLeft: marginLeft,
marginTop: 40,
padding: 0.1,
x: {
interval: "1 day",
type: "band"
},
y: {
domain: yDomain,
axis: null
},
color: {
domain: [0, maxMetric > minDistribution ? maxMetric : minDistribution],
range: ["#deebf7", "#9ecae1", "#3182bd"]
},
marks: [
Plot.axisY({
fontSize: width > 800 ? categoricalFontSize : categoricalFontSize * 0.75,
tickSize: 0,
label: null,
fontWeight: 600,
textAnchor: "start",
frameAnchor: "left",
textOverflow: "ellipsis-middle",
lineWidth: marginLeft / categoricalFontSize * 0.9
}),
Plot.axisX({
fontSize: width > 800 ? 11 : 10,
label: null,
tickSize: 0,
anchor: "top",
interval: Plot.utcInterval("week"),
}),
Plot.cell(heatmapData, {
x: accessors.date,
y: accessors.dimension,
fill: accessors.metric,
r: 2,
strokeOpacity: 0.25,
channels: {
["Page views"]: accessors.metric,
["Previous"]: accessors.compareMetric
},
tip: {
format: {
x: true,
y: false,
fill: false
},
lineHeight: 1.4,
fontSize: 12
}
}),
]
});