plotly / plotly/plotly.py

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

Abierto
#5,614 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug good first issue good for agent P3 size: 3
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza ejecutando la reproducción de Python proporcionada con Plotly 6.8.0 y pandas, comparando el fixed rangemode inicial con el comportamiento posterior de relayout. Sigue la inicialización del range-slider y la ruta de redraw para identificar por qué las barras grises aparecen solo en el renderizado inicial. Se considera terminado cuando el fixed rangemode se renderiza inicialmente sin las barras y el comportamiento sigue siendo correcto al cambiar de modo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
pandas, python
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
56/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.