Can't draw spike line across subplots with make_subplots in 4.0.0
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
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:

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

Is there any way around this? Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Python reproduction using make_subplots, shared_xaxes, and fig.update_xaxes(spikemode='across+marker'). Compare the generated subplot axis configuration in Plotly 4.0 with the earlier single-axis behavior. Done means identifying a supported way to make the spike line span all shared subplots, or documenting that limitation and its workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100