[英]Change Plotly scatter plot color
我在文檔中找到了這個color_discrete_sequence
參數,也許它可以幫助你https://plotly.com/python/discrete-color/#explicitly-constructing-a-color-sequence
import plotly.express as px
df = px.data.gapminder().query("year == 2007")
fig = px.bar(df, y="continent", x="pop", color="continent", orientation="h", hover_name="country",
color_discrete_sequence=["red", "green", "blue", "goldenrod", "magenta"],
title="Explicit color sequence"
)
fig.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.