Hi I am having trouble getting a lineplot to display properly. I have two axes and 5 line plots on one figure. The first y-axis limit cannot be set. I tried setting the range
property to [0,2]
, however it doesn't do anything and continues to show from -2 to 4. I want the straight linear plot to overlay directly on top of the other 4 line plots and I don't know why the x-axis starts from -5. Can someone help fix the issue?
fig = go.Figure()
xs = np.linspace(0,12.5,plot_df.shape[0])
for cn in plot_df.columns:
ys = plot_df[cn].to_numpy()
fig.add_trace(go.Scatter(x=xs, y=ys,
mode='lines',
name=cn)
)
fig.add_trace(go.Scatter(x=xs, y=xs,
mode='lines',
name='mob. grad', yaxis="y2")
)
fig.update_layout(
title = "UV and Mobile phase trace of {}".format(field_dict['sample_name']),
xaxis = dict(
title = "Minutes",
domain=[0.2, 1]
),
yaxis = dict(
scaleanchor = "x",
title = "UV Abs",
range = [0,2],
position = 0.19
),
yaxis2 = dict(
title = "Mobile Phase (%)",
anchor="free",
domain=[0.1,1],
overlaying="y",
side="left",
position=0.08,
range=[0,100])
)
fig.show()