Hi. A very newbie question. I have sparse data and I needed my y- axis to display values at the regular interval in order to show the difference between the recorded data points. The solution I found created an array with the needed values and declared it as y domain (as seen in this @mbostock Plot: Tick notebook. However, this is preventing me from implementing any y related styling. I am attaching the images of both charts. One has the styling I need but the y-axis is truncated and the second one is at the right scale due to y axis fix but I cannot repeat the styling.
dotPlot2 = Plot.plot({
width: Math.max(width, 550),
//y: { grid: true, label: "Time started cycling" }, //, reverse: true },
x: { label: "Day of the Month" },
y: {
grid: true,
label: "Time Started Cycling",
domain: y_axis_time ///
},
marks: [
Plot.textX(
data.filter((d) => d.DayOfWeek == "Saturday" || d.DayOfWeek == "Sunday"),
{
x: "dayOfMont",
y: 7,
text: "DayOfWeek",
stroke: "#e57827",
strokeWidth: 1
}
),
Plot.tickY(y_axis_time[11], {//not working
stroke: "red",
strokeDasharray: "2 2",
dx: 20
}), //not working
Plot.ruleY(
data.filter((d) => d.startHour == "12"), //not working
{ stroke: "red", strokeDasharray: "2 2" }
),
Plot.tickX(
data.filter((d) => d.DayOfWeek != "Saturday" || d.DayOfWeek != "Sunday"),
{ x: "dayOfMont", stroke: "lightgray", opacity: 0.3 }
),
Plot.tickX(
data.filter((d) => d.DayOfWeek == "Saturday" || d.DayOfWeek == "Sunday"),
{ x: "dayOfMont", stroke: "#042e5e", strokeWidth: 2.5, opacity: 0.3 }
),
Plot.dot(data, {
x: "dayOfMont",
r: "duration",
fill: " #2596be",
y: "startHour",
//interval: 0.5,
title: (d) =>
`${d.DayOfWeek}\n Minutes Cycling: ${d.minutes}\n Date: ${d.date} `
})
],
//width: 576,
tooltip: {
fill: "red",
stroke: "blue"
}
})