Bug: `make_subplots()` doesn't use shared x-axes for traces on different subplots, even when `shared_xaxes` is set to True
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- pandas, python
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện ví dụ make_subplots() được cung cấp với shared_xaxes=True và các tùy chọn spike-line đã cấu hình. Theo dõi cách subplot x-axes và hành vi hover được biểu diễn, sau đó xác định phần triển khai và các bài kiểm thử liên quan trước khi thay đổi chúng. Công việc được xem là hoàn tất khi di chuột qua bất kỳ subplot nào cũng hiển thị một spike-line dọc được căn chỉnh trên tất cả các subplot mà không làm hỏng bố cục của chúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When using make_subplots() with shared_xaxes=True, spike lines only appear on the subplot where the cursor is hovering, rather than showing across all subplots simultaneously.
Expected Behavior
When hovering over any subplot, a vertical spike line should appear at the same x-position across all subplots, similar to the behavior in TradingView or other financial charting tools.
Current Behavior
The spike line only appears on the subplot currently under the cursor. When moving to a different subplot, the spike line moves with the cursor instead of showing on all subplots.
Code Example
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
# Create sample data
df = pd.DataFrame({
'x': pd.date_range('2024-01-01', periods=100),
'y1': range(100),
'y2': [x**2 for x in range(100)]
})
# Create subplots
fig = make_subplots(
rows=2, cols=1,
shared_xaxes=True,
vertical_spacing=0.02
)
fig.add_trace(go.Scatter(x=df['x'], y=df['y1'], name='Line 1'), row=1, col=1)
fig.add_trace(go.Scatter(x=df['x'], y=df['y2'], name='Line 2'), row=2, col=1)
fig.update_xaxes(
showspikes=True,
spikemode='across',
spikesnap='cursor',
spikecolor='black',
spikethickness=1
)
fig.update_layout(hovermode='x unified')
fig.show()
What I've Tried
hovermode='x unified'- Only unifies hover labels, not spike linesfig.update_traces(xaxis='x')- Shows spikes across all subplots but breaks subplot layout (all data gets squeezed into first subplot's x-axis range)- Various combinations of
spikemode,spikesnap, andmatches='x'- No effect
Use Case
This feature is critical for financial/trading dashboards where users need to compare multiple indicators (price, volume, RSI, MACD, etc.) at the same point in time across multiple subplots.
- 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
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.
Issue khác của plotly/plotly.py
-
P3 size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug P1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
feature P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
feature P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Tất cả issue của plotly/plotly.py
Issue tương tự
-
link-check link-check:sphinx-theme
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
OpenHands/extensions#626 · 1 bình luận ·
-
Change observation tooltip text Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
CSCfi/sd-search-api#39 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100