首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法正确设置plot plot yaxis范围

无法正确设置plot plot yaxis范围
EN

Stack Overflow用户
提问于 2020-07-24 07:30:59
回答 1查看 74关注 0票数 0

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

代码语言:javascript
复制
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()

EN

回答 1

Stack Overflow用户

发布于 2020-08-05 23:58:46

我刚刚删除了scaleanchor = "x",它正常地显示了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63064615

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档