Skip to content

Can't draw spike line across subplots with make_subplots in 4.0.0 #1677

Open
@slishak

Description

@slishak

After upgrading to plotly 4.0.0, I can't see how to create a spike line across shared axes created with make_subplots.

Previously I was using code like this:

from plotly.tools import make_subplots
from plotly.io import write_html

fig = make_subplots(rows=4, cols=1, shared_xaxes=True)
x_vals = list(range(10))
y_vals = [x**2 for x in x_vals]
fig.add_scatter(x=x_vals, y=y_vals, row=1, col=1)
fig.add_scatter(x=x_vals, y=y_vals, row=2, col=1)
fig.add_scatter(x=x_vals, y=y_vals, row=3, col=1)
fig.add_scatter(x=x_vals, y=y_vals, row=4, col=1)

fig.update_xaxes(spikemode='across+marker')

write_html(fig, 'out.html', auto_open=True)

The resulting figure showed spike lines across axes because only one x axis was created:
image

But in 4.0, multiple x axes are created so the spike line no longer draws across all subplots:
image

Is there any way around this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions