使用 plotly 修改轴范围

Modify axes range using plotly

我正在使用以下代码通过 plotly 生成气泡图:

Dataframe.iplot(kind='bubble', x='branch', y='retention', size='active_users', text='active_users',
             xTitle='', yTitle='Retention',
             filename='cufflinks/PlotName')

我想为 Y 轴设置一个手动范围。 任何帮助将不胜感激。

import plotly.graph_objs as go    
layout = go.Layout(
        yaxis=dict(
            range=[0, 0.4]
        )
    )

    Dataframe.iplot(kind='bubble', x='branch', y='retention', size='active_users', text='active_users',
                 xTitle='', yTitle='Retention',
                 filename='cufflinks/PlotName', layout = layout)

这样就可以了。

适用于子图的解决方案是:

fig.update_yaxes(range=[0, 0.4], row=1, col=1)