如何在Python Plotly中创建具有共享x轴和范围滑块的子地块

如何在Python Plotly中创建具有共享x轴和范围滑块的子地块,python,plotly,Python,Plotly,我试图用Python和Plotly创建一个特定的绘图。我想知道是否有可能创建一个包含3个子地块的绘图,这些子地块垂直排列(),具有共享的x轴,以及控制x轴的范围滑块()?从2017年1月起,您不能这样做,请参见此处:从2017年1月起,您不能这样做,请参见此处:今天,2017年1月24日,我已经成功地创建了共享一个x轴的堆叠图,并结合了范围滑块。但是,问题是y轴的范围是自动设置的。我无法控制它。这对我来说是个难题。我的代码是: trace_1 = go.Scatter( x=time_s

我试图用Python和Plotly创建一个特定的绘图。我想知道是否有可能创建一个包含3个子地块的绘图,这些子地块垂直排列(),具有共享的x轴,以及控制x轴的范围滑块()?

从2017年1月起,您不能这样做,请参见此处:

从2017年1月起,您不能这样做,请参见此处:

今天,2017年1月24日,我已经成功地创建了共享一个x轴的堆叠图,并结合了范围滑块。但是,问题是y轴的范围是自动设置的。我无法控制它。这对我来说是个难题。我的代码是:

trace_1 = go.Scatter(
    x=time_station1,
    y=turb_station1,
    mode = 'lines+markers',
    name = 'Turbidity',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(64, 97, 139)',
        line = dict(
            width = 1,
            color = 'rgb(64, 97, 139)' 
        )
    )
)
trace_2 = go.Scatter(
    x=time_station1,
    y=battery_station1,
    yaxis='y2',
    mode = 'lines+markers',
    name = 'Battery',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(117, 15, 7)',
        line = dict(
            width = 1,
            color = 'rgb(117, 15, 7)'
        )
    )
)
trace_3 = go.Scatter(
    x=time_station1,
    y=cond_station1,
    yaxis='y3',
    mode = 'lines+markers',
    name = 'Conductivity',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(130, 0, 132)',
        line = dict(
            width = 1,
            color = 'rgb(130, 0, 132)'
        )
    )
)
trace_4 = go.Scatter(
    x=time_station1,
    y=depth_station1,
    yaxis='y4',
    mode = 'lines+markers',
    name = 'Depth',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(204, 100, 0)',
        line = dict(
            width = 1,
            color = 'rgb(204, 100, 0)'
        )
    )
)
trace_5 = go.Scatter(
    x=time_station1,
    y=temp_station1,
    yaxis='y5',
    mode = 'lines+markers',
    name = 'Temperature',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(255, 255, 0)',
        line = dict(
            width = 1,
            color = 'rgb(255, 255, 0)'
        )
    )
)

layout = go.Layout(
    title='Station ABC',
    xaxis = dict(
        rangeselector=dict(
            buttons = list([
                dict(count=1,
                     label='1min',
                     step='minute',
                     stepmode='backward'),
                dict(count=24,
                     label='24h',
                     step='hour',
                     stepmode='backward'),    
            ])
        ),
        rangeslider=dict(),
        type='date',
        title='Date and Time'
    ),
    yaxis=dict(
        domain=[0,0.15]),
    yaxis2=dict(
        domain=[0.2,0.35]),
    yaxis3=dict(
        domain=[0.4,0.55]),
    yaxis4=dict(
        domain=[0.4,0.75]),
    yaxis5=dict(
        domain=[0.8,1]),
        )

data = [trace_1, trace_2, trace_3, trace_4, trace_5]

plot_url = py.plot(fig, filename='offline plot.html')

今天,2017年1月24日,我成功创建了共享一个x轴的堆叠图,并结合了范围滑块。但是,问题是y轴的范围是自动设置的。我无法控制它。这对我来说是个难题。我的代码是:

trace_1 = go.Scatter(
    x=time_station1,
    y=turb_station1,
    mode = 'lines+markers',
    name = 'Turbidity',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(64, 97, 139)',
        line = dict(
            width = 1,
            color = 'rgb(64, 97, 139)' 
        )
    )
)
trace_2 = go.Scatter(
    x=time_station1,
    y=battery_station1,
    yaxis='y2',
    mode = 'lines+markers',
    name = 'Battery',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(117, 15, 7)',
        line = dict(
            width = 1,
            color = 'rgb(117, 15, 7)'
        )
    )
)
trace_3 = go.Scatter(
    x=time_station1,
    y=cond_station1,
    yaxis='y3',
    mode = 'lines+markers',
    name = 'Conductivity',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(130, 0, 132)',
        line = dict(
            width = 1,
            color = 'rgb(130, 0, 132)'
        )
    )
)
trace_4 = go.Scatter(
    x=time_station1,
    y=depth_station1,
    yaxis='y4',
    mode = 'lines+markers',
    name = 'Depth',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(204, 100, 0)',
        line = dict(
            width = 1,
            color = 'rgb(204, 100, 0)'
        )
    )
)
trace_5 = go.Scatter(
    x=time_station1,
    y=temp_station1,
    yaxis='y5',
    mode = 'lines+markers',
    name = 'Temperature',
    connectgaps = False,
    marker = dict(
        size = 5,
        color = 'rgb(255, 255, 0)',
        line = dict(
            width = 1,
            color = 'rgb(255, 255, 0)'
        )
    )
)

layout = go.Layout(
    title='Station ABC',
    xaxis = dict(
        rangeselector=dict(
            buttons = list([
                dict(count=1,
                     label='1min',
                     step='minute',
                     stepmode='backward'),
                dict(count=24,
                     label='24h',
                     step='hour',
                     stepmode='backward'),    
            ])
        ),
        rangeslider=dict(),
        type='date',
        title='Date and Time'
    ),
    yaxis=dict(
        domain=[0,0.15]),
    yaxis2=dict(
        domain=[0.2,0.35]),
    yaxis3=dict(
        domain=[0.4,0.55]),
    yaxis4=dict(
        domain=[0.4,0.75]),
    yaxis5=dict(
        domain=[0.8,1]),
        )

data = [trace_1, trace_2, trace_3, trace_4, trace_5]

plot_url = py.plot(fig, filename='offline plot.html')

对不起,我不明白为什么它不可能了。对不起,我不明白为什么它不可能了。