Fra*_*igo 9 python colors plotly plotly-python
我可以使用以下方法更改默认主题:
import plotly.io as pio
pio.templates.default = 'plotly_white'
Run Code Online (Sandbox Code Playgroud)
但我如何更改默认调色板?
要添加自定义主题,请修改pio.templates
:
import plotly.io as pio
import plotly.graph_objects as go
pio.templates["custom_theme"] = go.layout.Template(
layout=go.Layout(
colorway=['#ff0000', '#00ff00', '#0000ff']
)
)
pio.templates.default = 'custom_theme'
Run Code Online (Sandbox Code Playgroud)
在此处查看更多信息:https ://plotly.com/python/templates/# saving-and-distributing-custom-themes
如果添加以下内容,您还可以组合主题"+"
:
pio.templates.default = 'plotly_white+custom_theme'
Run Code Online (Sandbox Code Playgroud)