简体   繁体   English

在 plotly 中改变 y 轴的颜色 label

[英]Change color of y axis label in plotly

I draw a figure in plotly (python).我在plotly(python)中画了一个图。 To change the label color of y axis in the plot I used the code fig.update_yaxes(color='white') and fig.update_layout(font_color="white") but unfortunately both of them didn't work, what else can I do?要更改 plot 中 y 轴的 label 颜色,我使用了代码fig.update_yaxes(color='white')fig.update_layout(font_color="white")但不幸的是它们都不起作用,我还能做什么做?

My code:我的代码:

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

在此处输入图像描述

You can use:您可以使用:

fig.update_yaxes(title_font_color="red")

You can look here for more settings.您可以在此处查看更多设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM