✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Link 2D and 3D axes

Hi,

I have plotted a 2D line plot and 3D surface plot as subplots in a figure.
Now, I want to link x-axes of both these plots.

I tried using the following command in plotly4:

fig.update_xaxes(matches=‘x’)

I notice that the above command works fine as long as all the subplots are 2D. But it’s not working when one of the plots is 3D.

Any solution for this?!

This is my full code:

import plotly.graph_objects as go
from plotly.subplots import make_subplots

fig = make_subplots(
rows=2, cols=1,
specs=[[{}],
[{‘type’: ‘surface’}]], subplot_titles=(“Signal”, “Spectrogram”),
print_grid=True)

fig.add_trace(
go.Scatter(y=signal, x=t),
row=1, col=1
)

fig.add_trace(
go.Heatmap(
x= t,
y= f,
z= 10*numpy.log10(Spect),
colorscale=‘Peach’,
showscale=False
),
row=2, col=1
)

fig.update_xaxes(matches=‘x’)
fig.show()