python plot 坐标轴范围_如何在Python Plotly中创建具有共享x轴和范围滑块的子图 (How to create a subplot with shared x-axis and ...

Today, Jan 24th 2017, I have managed to create stacked plots that share one x-axis, in combination with a range slider. However, the problem is that the range of the y-axis is automatically set. I cannot control it. This is a plroblem for me. My code is:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值