question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
nicolaskruchtencommented, Jul 24, 2019

As a simple workaround, you can just do fig.update_traces(xaxis="x1") which rebinds all your traces to the x-axis you want the spikelines to join up with.

2reactions
rysktkycommented, Jul 25, 2019

Thanks it works! Just needed to set it to the xaxis which is at the bottom. Then the ticklabels remain visible. fig.update_traces(xaxis="x4")

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly Spikes Not Appearing on Subplots - Stack Overflow
I am making a figure with multiple subplots. I want each subplot to show spikes but am unable to get the spikes showing...
Read more >
Is it possible making spike lines in several subplots having 2 ...
Is there any method applying vertical spike line sharing x-axis in all ... Can't draw spike line across subplots with make_subplots in 4.0.0....
Read more >
Plotly Subplots & Plot Layering - Medium
So we can not use make_subplots with plotly.express plots. We'll use this code for importing the library to project. from plotly.subplots import ...
Read more >
Creating Various Plot Types and Subplots with Plotly
We will look at bar charts, histograms, scatter/bubble charts, and box plots. As we did in the my previous article on this topic,...
Read more >
Supplementary material
Figure S1: The spike sorting algorithm at work. Upper subplot: 60 sec of continuous, bandpass-filtered data and the threshold used for detection (red...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found