plotly / plotly/plotly.py

Colorbar is not showing last tick

Open
#5,066 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Hi,
I have added a horizontal colorbar to a heatmap figure and can't get the last tick to show. Here are some of things I tried and thought are the most logical:

colorbar= dict(
            orientation='h',
            y=1.01,
            tickformat=".0%",
            tickmode='array',
            tickvals=[0, 0.25, 0.5, 0.75, 1],
            showticksuffix='last',
            ), 

and

colorbar= dict(
            orientation='h',
            y=1.01,
            tickformat=".0%",
            tickmode='linear',
            tick0=0,
            dtick=0.25,
            nticks=5,
            ticklabeloverflow="allow",
            ), 

but both yield the same result:
Image

I have also tried moving the bar around the x axis and played with labels and length, but it always seems missing.

Is this a bug?

Plotly: 5.24.1 and Python: 3.12.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the horizontal heatmap colorbar with the provided tickmode='array' and tickmode='linear' configurations using Plotly 5.24.1 and Python 3.12.7. Trace how the colorbar handles the final tick and verify the fix by confirming that the 1.0 tick label is rendered without affecting the other labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.