零零线不透明度

问题描述 投票:1回答:1

是否有一种方法可以更改零线的不透明度?我试图在我的图上为我的y轴分层零线,以使其不会出现在后面,但其不透明度/ alpha为50%。这可能吗?

python r graph plotly axes
1个回答
0
投票

[您可以将rgba colorfig.update_xaxes()和/或fig.update_yaxes()结合使用以获得所需的任何不透明度的任何颜色:

enter image description here

完整代码:

import plotly.express as px

fig = px.line(y=[1, -1], x=[-1,1])

fig.update_xaxes(zeroline=True, zerolinewidth=6, zerolinecolor='rgba(0,255,0,0.5)')
fig.update_yaxes(zeroline=True, zerolinewidth=6, zerolinecolor='rgba(0,0,255,0.5)')

fig.show()
© www.soinside.com 2019 - 2024. All rights reserved.