Skip to content

[BUG]: Heatmap with a single x value on a category axis is drawn at 2× its category index #8175

Open

Description

@carlocastoldi

Description

When a heatmap trace has exactly one x value on a categorical x-axis, its column is drawn at twice the category’s index. This only shows when that category isn’t the first one on the axis.

Minimal example

Plotly.newPlot('gd', [
  {type: 'heatmap', x: ['b','c'], y: ['x','y','z'], z: [[1,4],[2,5],[3,6]]},
  {type: 'heatmap', x: ['a'],     y: ['x','y','z'], z: [[7],[8],[9]]}
]);

Expected: column a at position 2, right next to c.
Actual: column a is drawn at position 4, the axis range grows to [-0.5, 4.5], and there’s a gap. With 3 categories before it, it lands at 6. When the trace comes first (index 0), it looks correct.

Workaround: numeric x with tickvals/ticktext.

Tested with plotly.js 4.1.1 (via plotly.py 7.1.0).

Screenshots/Video

image

Activity

  1. camdecoster commented on Nov 18, 2026

    @camdecoster
    Contributor

    Thanks for the report! This does seem like a bug. Our team likely won't be able to get to this any time soon. Would you be interested in investigating and creating a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions