Hi, I am trying to create a dynamically updated graph to show my signal recordings. I got to the point of adding the signals to the same plot, but they don’t spread equally across the height of the plot. Also I would like to use the rangeslider but without any summary of all of the signals plot since it seems it affects the plotting speed:
The code that I am using is the following:
df = celltraces
cell_names = celltraces.columns[celltraces.columns.str.startswith(‘C’)]
fig = go.Figure()
#%%
def create_yaxis_dict(n_cells):
fig_plotly = {}
for n in range(n_cells):
y_name = ‘’.join([‘yaxis’, str(n+1)])
fig_plotly[y_name] = dict(anchor="x",
autorange=True,
domain=[(n*0.01), ((n+1)*0.01)],
linecolor="#E91E63",
mirror=True,
showline=True,
side="right",
tickfont={"color": "#E91E63"},
tickmode="auto",
ticks="",
titlefont={"color": "#E91E63"},
type="linear",
zeroline=False)
return fig_plotly
#%%
df = to_plot
i = 0
y_lbl =
for n in range(cell_names.shape[0]):
y_lbl.append(’’.join([‘y’, str(n+1)]))
for key_name in cell_names:
fig.add_trace(go.Scatter(x=df.index, y=df[key_name],
mode=‘lines’,
name=key_name,
yaxis=y_lbl[i],
))
i = i + 1
fig.update_traces(
hoverinfo=“name+y+text”,
line={“width”: 1},
mode=“lines”,
)
Add range slider
fig.update_layout(
xaxis=dict(
autorange=True,
# rangeslider=dict(
# autorange=True
# ),
type=‘linear’
)
)
fig.update_layout(create_yaxis_dict(cell_names.shape[0]))
fig.update_layout(
dragmode=“zoom”,
hovermode=“x”,
legend=dict(traceorder=“reversed”),
autosize = False,
template=“plotly_dark”,
margin=dict(
l=20,
r=20,
b=100
),
)
fig.show()