您好,我有一个问题,使线条图显示正确。我在一个图形上有两个轴和5个线状图。无法设置第一个y轴限制。我尝试将range属性设置为[0,2],但是它什么也不做,并且继续从-2到4显示。我希望直线线状图直接覆盖在其他4个线状图的顶部,但我不知道为什么x轴从-5开始。有人能帮助解决这个问题吗?
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()

发布于 2020-08-05 23:58:46
我刚刚删除了scaleanchor = "x",它正常地显示了。
https://stackoverflow.com/questions/63064615
复制相似问题