在绘图中更改 y 轴标签的颜色

时间:2021-07-23 17:16:06

标签: python plotly plotly-python

我在 plotly (python) 中绘制了一个图形。要更改图中 y 轴的标签颜色,我使用了代码 fig.update_yaxes(color='white')fig.update_layout(font_color="white") 但不幸的是它们都不起作用,我还能做什么?

我的代码:

        for index, i in enumerate(values):
            fig_1.add_trace(go.Scatter(x=[today], y=[i], mode='markers', name=names[index], marker_symbol='star-triangle-up', marker_size=15))

        fig_1.update_layout(
            xaxis_title="",
        )

        fig_1.update_layout( height=450, width=700,xaxis_title="", plot_bgcolor='rgba(65, 104, 119, 0.8)',   )                   
        fig_1.update_layout(legend=dict(
            yanchor="top",

            y=0.99,
            xanchor="left",
            x=0.01,
            )
                    )
        fig_1.layout.yaxis.color = 'white'

        fig_1.update_xaxes(color='white') 
        fig_1.update_yaxes(color='white') 

enter image description here

0 个答案:

没有答案