简体   繁体   中英

Change color of y axis label in plotly

I draw a figure in 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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