I have data points that belong to three different classes. On the other hand, I have weight for each data point in its class. I want to color my points based on their weight, but with three different continuous range of colors. Actually I want something like the following image (which is made by hand). Now I'm using Plotly for coloring, but any other method compatible with python is welcomed.
Actually I want to combine the two output of the code:
if __name__ == '__main__':
n_data = 100
n_class = 3
t1 = [random.random() for i in range(n_data)]
t2 = [random.random() for i in range(n_data)]
class_color = [str(random.randint(1,n_class)) for i in range(n_data)]
weight_color = [random.random() for i in range(n_data)]
df = pd.DataFrame()
print(len(t1))
print(len(t2))
df['x'] = t1
df['y'] = t2
df['class_color'] = class_color
df['weight_color'] = weight_color
fig1 = px.scatter(df, x="x", y="y", color="class_color")
fig1.show()
fig2 = px.scatter(df, x="x", y="y", color="weight_color")
fig2.show()

