Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug:make_subplots() doesn't use shared x-axes for traces on different subplots, even whenshared_xaxes is set to True #5427

Open
@videni

Description

@videni

Description

When usingmake_subplots() withshared_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 acrossall 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 gofrom plotly.subplots import make_subplotsimport pandas as pd# Create sample datadf = pd.DataFrame({    'x': pd.date_range('2024-01-01', periods=100),    'y1': range(100),    'y2': [x**2 for x in range(100)]})# Create subplotsfig = 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

  1. hovermode='x unified' - Only unifies hover labels, not spike lines
  2. fig.update_traces(xaxis='x') - Shows spikes across all subplots but breaks subplot layout (all data gets squeezed into first subplot's x-axis range)
  3. Various combinations ofspikemode,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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp