plotly / plotly/plotly.py

[BUG]: Range slider y-axis "fixed" rangemode renders unexpected thick horizontal bars on initial load

Open
#5,614 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue good for agent P3 size: 3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Description

When initializing a Plotly chart with an xaxis range slider that has its yaxis.rangemode set to "fixed", the chart initially renders two extra, thick, solid gray horizontal bars stretching across the entire width of the range slider track.

However, this appears to be a visual artifact or initialization bug: if you dynamically toggle the rangemode to "auto" or "match" (via an updatemenu dropdown) and then switch it back to "fixed", the gray bars disappear entirely, and the range slider track displays normally as expected.

Screenshots/Video

Initial render (Buggy):

Image

After toggling to "Auto"/"Match" and back to "Fixed" (Expected):

Image
Steps to reproduce
  1. Run the provided Python script to generate the Plotly figure.
  2. Observe the range slider at the bottom of the chart upon initial rendering. Note the unexpected thick gray horizontal bars spanning the slider track.
  3. Use the dropdown menu in the top-left corner to select "Rangemode: Auto/Match".
  4. Use the dropdown menu again to select "Rangemode: Fixed".
  5. Observe that the range slider now looks correct and the gray bars have vanished.
import plotly; print(plotly.__version__) # 6.8.0
import pandas as pd

pd.options.plotting.backend = "plotly"

df = pd.DataFrame(dict(a=[1, 3, 2], b=[3, 2, 1]))
fig = df.plot.line()

fig.update_layout(xaxis=dict(rangeslider=dict(visible=True, yaxis=dict(rangemode="fixed"))))

fig.update_layout(
    updatemenus=[
        dict(
            type="dropdown",
            active=1,
            buttons=[
                dict(
                    label="Rangemode: Auto",
                    method="relayout",
                    args=[{"xaxis.rangeslider.yaxis.rangemode": "auto"}],
                ),
                dict(
                    label="Rangemode: Fixed",
                    method="relayout",
                    args=[{"xaxis.rangeslider.yaxis.rangemode": "fixed"}],
                ),
                dict(
                    label="Rangemode: match",
                    method="relayout",
                    args=[{"xaxis.rangeslider.yaxis.rangemode": "match"}],
                ),
            ],
        )
    ]
)

fig.show()

Notes
  • Environment: Verified using plotly version 6.8.0 alongside pandas plotting backend.
  • This behavior suggests a missing or improper initialization redraw when rangemode="fixed" is passed via the initial layout configuration, which is subsequently corrected whenever relayout triggers a fresh calculation of the range slider boundaries.

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

Start by running the provided Python reproduction with Plotly 6.8.0 and pandas, comparing the initial fixed rangemode with the later relayout behavior. Trace the range-slider initialization and redraw path to identify why the gray bars appear only on initial render. Done means fixed rangemode renders without the bars initially and the behavior remains correct when switching modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.