Help to customize the y axis with Observable Plot

I want to draw a timeline using Plot with the time on the y axis.

It would be good if I could customize the y axis by showing labels with a 10 year step or maybe 20 years.

It’s unclear to me how to choose the number of labels displayed on the axis.

1 Like

I think the issue is that you are not parsing the date strings to dates. Your dates are therefore treated as categorical and you get a label for each category. If you parse them properly, then you should get a continuous scale.

To do so, in your definition of get_date you might change this line near the end

date: res.date.value

to

date: d3.utcParse("%Y-%m-%dT%H:%M:%SZ")(res.date.value)

I did this and the scale definitely looks sparse, as you want. The picture is different, though, and I’m not sure if it’s what you want or not.

1 Like

thank you for your answer. It works!