Unify hovertemplate title cannot be edited.
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
It seems that we cannot modify the title of the hovertemplate when the chart uses a unify hovermode whenever the axis has not a date type.
Here a short example with 2 scatter plots, the first one with a date axis and the second is linear:
import numpy as np
import pandas as pd
from plotly.subplots import make_subplots
dates = pd.date_range("2022-01-01", "2022-03-01")
values = np.random.randint(0, 10, len(dates))
fig = make_subplots(cols=2)
fig.add_scatter(x=dates, y=values, row=1, col=1)
fig.add_scatter(x=values, y=values, mode="markers", row=1, col=2)
fig.update_traces(hovertemplate="%{y}<extra></extra>")
fig.update_xaxes(row=1, col=1, hoverformat=" ")
fig.update_xaxes(row=1, col=2, type="linear", hoverformat=" ")
fig.update_layout(hovermode="x unified")
fig.show()
If you force the second scatter to be a date type, the hovertemplate title is removed with the workaround hoverformat=" ". However, it only works for date axis.
Here some references/related issues:
https://github.com/plotly/plotly.py/issues/4278
https://community.plotly.com/t/customizing-text-on-x-unified-hovering/39440/18
https://community.plotly.com/t/pass-nothing-or-disable-x-axis-hoverformat/67496
plotly version = 5.18.0
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
Chạy bản tái hiện Python được cung cấp với plotly 5.18.0 và so sánh các trường hợp date-axis và linear-axis. Đọc issue liên quan #4278 và các cuộc thảo luận cộng đồng được liên kết; được xem là hoàn thành khi unified hover trên một linear axis cho phép xóa hoặc tùy chỉnh tiêu đề của hovertemplate mà không buộc phải dùng date axis, kèm theo kiểm thử hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- numpy, 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
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100