Plotting Dates in Plot

I find myself making a lot of plots with a quantity over time and I’m wondering about a good way to handle the ticks.


My first thought for this plot is to use a bar mark, but there are a lot of ticks and I end up having to rotate them.

I’d rather only show a few years as tick labels.

I feel like this is bonking up against transform stuff like group, bin, and intervals. Is there a better way to approach this chart in Plot?

  • A different mark like a rect?
  • A way to limit tick labels for a bar mark?
  • Converting the years to Dates?

Thanks, appreciate your help.

Always learning,


I find that when working with time, I get a lot better results when I use JS Date objects, and then let Plot work it’s magic (with a bit of help from it’s console messages).

I forked your notebook, and changed 3 things:

  • Converted the year column to be Date objects representing January 1st of the given year.
  • Switched to a rect mark instead of a bar mark and set an interval, as suggested by Plot’s warnings.
  • In the second chart, I show how you can approximately customize the number of ticks.

Aha, so there WAS some magic involved. Thanks so much!