1 回答
TA贡献1735条经验 获得超5个赞
我找到了答案。显然要反转轴,您不需要自动调整它的范围,而只需向后设置范围
layout1= go.Layout(title=go.layout.Title(text="A graph",x=0.5),
# xaxis={'title':'y[m]','autorange':'reversed','range':[-10,10]},
xaxis={'title':'y[m]'},
yaxis={'title':'x[m]', 'side':'right'})
# switch the x- and y-coordinates
point_plot=[
go.Scatter(y=[3],x=[1],name="V0"),
go.Scatter(y=[5],x=[2],name="GT"),
go.Scatter(y=[0],x=[0],name="egoCar")
]
fig = go.Figure(data=point_plot, layout=layout1)
# reverse the range of the xaxis (which contains the y values)
#fig.update_xaxes(autorange="reversed")
fig.update_xaxes(range=[10,-10]) #BACKWARDS
fig.show()
添加回答
举报