如何设置y轴的范围

15 浏览
0 Comments

如何设置y轴的范围

我有以下代码用于使用Plotly创建线图。如何将Y轴的范围设置为始终在[0; 10]之间?

layout = go.Layout(
        title=go.layout.Title(
            text="测试",
            xref='paper',
            x=0
        ),
        xaxis=go.layout.XAxis(
            tickmode='linear',
            tickfont=dict(
                size=10
            ),
            title=go.layout.xaxis.Title(
                font=dict(
                    size=14,
                    color='#7f7f7f'
                )
            )
        ),
        yaxis=go.layout.YAxis(
            title=go.layout.yaxis.Title(
                text=y,
                font=dict(
                    size=14,
                    color='#7f7f7f'
                )
            ),
            range=[0, 10]
        )
    )
    data = [go.Scatter(x=x1, y=y1)]

0