plotly / plotly/plotly.py

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

Đang mở
#5,614 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug good first issue good for agent P3 size: 3
Ngôn ngữ chính
Python
Star
18.8k
Fork
2.8k
Merge trung bình
16 giờ 26 phút
Pull request đã merge (30 ngày)
21

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện Python được cung cấp với Plotly 6.8.0 và pandas, đồng thời so sánh fixed rangemode ban đầu với hành vi relayout về sau. Theo dõi quá trình khởi tạo range-slider và đường dẫn redraw để xác định tại sao các thanh màu xám chỉ xuất hiện khi render ban đầu. Hoàn tất có nghĩa là fixed rangemode được render ban đầu mà không có các thanh này và hành vi vẫn chính xác khi chuyển đổi giữa các chế độ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
pandas, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
56/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.