Plot: cell mark vs rect mark

I would like to make a figure with a cell grid based on categorical data.
The result should look something like this:

From the cell mark documentation

But I struggle to get the categorical data displayed on the x-axis.
What am I missing here (little example):

  x: { type: "band" },
  y: { type: "band" },
  marks: [Plot.cell(cat_data, { x: "favorite - color", y: "subject-id" })]

From this example notebook:

I would like to have a cell highlighted in the grid that corresponds to the “favorite color”.

Thanks for your help.

It’s the space in your CSV data – this was causing the field name of each row JavaScript object to have a space.

I sent your notebook a suggestion that fixes it:


Wow, great!
Thanks for your help

1 Like