简体   繁体   中英

How do I change the colors of the graph using dash plotly in python

I find a lot of examples of black graph sheets, with blue axis, but don't know how to do that. how do I do that?

this doesn't work:

chart01.update_layout(plot_bgcolor="#1c0d02")

plot_bgcolor attribute sets the background color of the plotting area in-between x and y axes. So if you want to have your graph all in black you need to set the paper_bgcolor attribute too the dark color. This attribute sets the background color of the paper where the graph is drawn see plotly layout .

Or you can simply use plotly templates Plotly built-in themes . Here is an example using the plotly_dark template.

import plotly.express as px

# Use plotly_dark template
fig = px.line(x=[1, 2, 3, 4, 5], y=[3, 4, 5, 1, 2])
fig.update_layout(template='plotly_dark')

fig.show()

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