【问题标题】:How to automatically adjust plotly Y range on price chart如何在价格图表上自动调整 Y 范围
【发布时间】:2018-04-25 02:50:43
【问题描述】:

我绘制了一个价格图表。 Y 轴刻度设置为整个价格范围内的最低和最高价格。

当我减小范围时,例如当我显示最后一小时时,Y 轴不会缩放并且给出相同的范围。如何使 Y 轴自动缩放到可见的价格范围?

这是我的布局

layout = go.Layout(
        title=title,
        legend=dict(orientation="h"),
        xaxis=dict(
            rangeselector=dict(
                buttons=list([
                    dict(count=1,
                         label='1h',
                         step='hour',
                         stepmode='backward'),
                    dict(count=3,
                         label='3h',
                         step='hour',
                         stepmode='backward'),
                    dict(count=6,
                         label='6h',
                         step='hour',
                         stepmode='backward'),
                    dict(count=1,
                         label='1d',
                         step='day',
                         stepmode='backward'),
                    dict(count=3,
                         label='3d',
                         step='day',
                         stepmode='backward'),
                    dict(step='all')
                ])
            ),
            rangeslider=dict(),
            type='date'
        ),
        yaxis=dict(
            title=y_axis_label,
            showticklabels= not seperate_y_axis,
            autorange=True,
            type='linear'
        )
    )

【问题讨论】:

    标签: python charts jupyter-notebook plotly


    【解决方案1】:

    我认为现在在 plotly 中是不可能的(见https://community.plot.ly/t/range-slider-and-selector-in-plotly-js-without-fixed-y-axis/1475,https://community.plot.ly/t/autoscaling-the-y-axis-when-using-rangeslider/1456)

    您必须使用范围滑块吗?也许不同的布局会起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-27
      • 2022-08-14
      • 2020-04-05
      • 1970-01-01
      • 1970-01-01
      • 2021-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多