使用Plotly修改轴范围

14

我正在使用以下代码来使用plotly生成一个气泡图:

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

我想为Y轴设置手动范围。感谢您的任何帮助。

2个回答

20

与子图subplot一起使用的解决方案是:

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

你如何设置你的fig? - Eli Borodach
1
抱歉 @EliBorodach,耽搁了。ax, fig = plt.subplots(...) - aerijman

14
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)

这会有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接