How do I create a plot with two y-axis as in the Plot.ly docs example except using Flask?
The code below appropriately produces the plot, but I cant figure out how I might add the layout object.
If this is simply not sanely possible using Plotly, is there a straightforward solution using Dash? I cant seem to find Dash examples equivalent to the linked Plotly examples.
xScale = np.linspace(0, 1, len(acoustic_data))
xScale2 = np.linspace(0, 1, len(time_to_failure))
# Create traces
acoustic_data = go.Scatter(
x=xScale,
y=acoustic_data,
name='acoustic data'
)
time_to_failure = go.Scatter(
x=xScale2,
y=time_to_failure,
name='time to failure',
# yaxis='y2'
)
# How do I integrate the layout?
layout = go.Layout(
title='Earthquick',
yaxis=dict(
title='acoustic data'
),
yaxis2=dict(
title='time to failure',
overlaying='y',
side='right'
)
)
data = [acoustic_data, time_to_failure]
graphJSON = json.dumps(data, cls=plotly.utils.PlotlyJSONEncoder)
return graphJSON