Answers for "python create adictionary randomly assigning clors to categorical vairables"

0

python create adictionary randomly assigning clors to categorical vairables

# Unique category labels: 'D', 'F', 'G', ...
color_labels = df['color'].unique()

# List of RGB triplets
rgb_values = sns.color_palette("Set2", 8)

# Map label to RGB
color_map = dict(zip(color_labels, rgb_values))

# Finally use the mapped values
plt.scatter(df['carat'], df['price'], c=df['color'].map(color_map))
Posted by: Guest on April-17-2020
0

python create adictionary randomly assigning clors to categorical vairables

sns.palplot(sns.color_palette("Set2", 8))
Posted by: Guest on April-17-2020
0

python create adictionary randomly assigning clors to categorical vairables

# Unique category labels: 'D', 'F', 'G', ...
color_labels = df['color'].unique()

# List of RGB triplets
rgb_values = sns.color_palette("Set2", 8)

# Map label to RGB
color_map = dict(zip(color_labels, rgb_values))

# Finally use the mapped values
plt.scatter(df['carat'], df['price'], c=df['color'].map(color_map))
Posted by: Guest on April-17-2020
0

python create adictionary randomly assigning clors to categorical vairables

sns.palplot(sns.color_palette("Set2", 8))
Posted by: Guest on April-17-2020

Code answers related to "python create adictionary randomly assigning clors to categorical vairables"

Python Answers by Framework

Browse Popular Code Answers by Language