Automatically set maximum x-scale limit based on peak frequency

master
Dan Howe 5 years ago
parent 8b0022c054
commit af754786d9

@ -146,12 +146,15 @@ def read_json_data(json_data):
trace = go.Scatter(x=dfs.index, y=dfs[col], name=col, opacity=0.8) trace = go.Scatter(x=dfs.index, y=dfs[col], name=col, opacity=0.8)
spec.append(trace) spec.append(trace)
# Set maximum x limit to 200% of the peak frequency
f_max = dfs.idxmax().mean() * 3
graph_energy = dcc.Graph(id='energy-spectrum', graph_energy = dcc.Graph(id='energy-spectrum',
figure={ figure={
'data': spec, 'data': spec,
'layout': { 'layout': {
'xaxis': { 'xaxis': {
'range': [0, 3] 'range': [0, f_max]
} }
} }
}) })

Loading…
Cancel
Save