javascriptobservablehq

ObservableHQ faceted plot remove x-axes ticks


I am trying to get rid of x-axis ticks for individual bar plots in this faceted plot. This plot is generated using ObservableHQ's Plot object.

Plot.plot({
  marginLeft: 10,
  marginRight: 10,
  label: null,
  y: { padding: 0, label: "Channels (Log_2)" },
  color: {
    legend: true,
  },
  marks: [
    Plot.barY(processed_data, {
      fx: "layer",
      x: "concept",
      y: "channel",
      fill: "concept",
      inset: 0.5,
    }),
    Plot.ruleX([0])
  ],
});

I want the ticks to be removed from the bottom, because it is redundant as the class is encoded as colors.


Solution

  • It can be disabled by simply specifying an empty tick list.

    Plot.plot({
      marginLeft: 10,
      marginRight: 10,
      label: null,
      y: { padding: 0, label: "Channels (Log_2)" },
      color: {
        legend: true,
      },
      marks: [
        Plot.barY(processed_data, {
          fx: "layer",
          x: "concept",
          y: "channel",
          fill: "concept",
          inset: 0.5,
        }),
        Plot.axisX({ticks: []}),
        Plot.ruleX([0])
      ],
    });