Bar plot hover shows incorrect bar length when base is used
Chưa có ai nhận issue này.
- 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ả
Hello,
I tried making something like a Gantt chart and use the Bar plot type for that. It seems the hover effect is mixing up the columns somehow. Here is a minimal reproduction:
import pandas as pd
import plotly.express as px
gantt = []
gantt.append(dict(Begin=0, End=1, Word='Foo'))
gantt.append(dict(Begin=2, End=5, Word='Bar'))
gantt_df = pd.DataFrame(gantt)
gantt_df['Duration'] = (gantt_df['End'] - gantt_df['Begin'])
fig = px.bar(gantt_df, base="Begin", y="Duration", x="Word")
fig.show()
Here is the result:
Things of note:
- The position and size of the bars is correct
- The "Begin" annotation in the hover is correct
- The "Duration" annotation shows the value of the "End" column, which is not correct. I would expect "End=5" or "Duration=3" but not "Duration=5"
Examining the pandas dataframe itself shows that the data itself is correct:
This is my version according to conda:
plotly 5.23.0 pyhd8ed1ab_0 conda-forge
Thank you for providing this great library for free and I hope that you find my report helpful.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- 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 tối thiểu của pandas và plotly.express từ issue với plotly 5.23.0, rồi so sánh các trường hover của thanh được hiển thị với Begin, End và Duration trong dataframe. Công việc hoàn tất khi vị trí của các thanh vẫn chính xác và hover hiển thị giá trị Duration mong đợi thay vì End.
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100