Reputation: 1
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()
Upvotes: 0
Views: 289
Reputation: 35230
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()
Upvotes: 2