情节:如何扩展情节表达散点图的色彩?

发布于 2025-02-10 13:06:50 字数 310 浏览 1 评论 0原文

这是我的代码。但是有些颜色是回收的。我需要52种不同种类的颜色。我该如何解决这个问题?

fig = px.scatter(Xt[:,0], Xt[:,1], color=DF["ScientifName"])
fig.show()

This is my code. But some colors are recycled. I need 52 different kinds of color. How can I solve this problem?

fig = px.scatter(Xt[:,0], Xt[:,1], color=DF["ScientifName"])
fig.show()

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烈酒灼喉 2025-02-17 13:06:50

有一个创建任意颜色类型的函数。所需的图将通过将创建的颜色列表设置为颜色来创建。请参阅详细信息

import plotly.express as px
from plotly.colors import n_colors
import numpy as np

x = np.random.randint(0,53,52)
y = np.random.randint(0,53,52)

red_blue = n_colors('rgb(0, 0, 255)', 'rgb(255, 0, 0)', 52, colortype = 'rgb')

fig = px.scatter(x, y, color=red_blue)
fig.show()

There is a function to create arbitrary color types. The desired graph will be created by setting the created color list to color. See this for details.

import plotly.express as px
from plotly.colors import n_colors
import numpy as np

x = np.random.randint(0,53,52)
y = np.random.randint(0,53,52)

red_blue = n_colors('rgb(0, 0, 255)', 'rgb(255, 0, 0)', 52, colortype = 'rgb')

fig = px.scatter(x, y, color=red_blue)
fig.show()

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文