I have a scatterplot that should show the changes in bond lengths depending on temperature. I wanted to give each temperature a specific color, but it doesn't seem to work - plot uses the default seaborn palette. Is there a way to map temperature to color, and make seaborn use it?
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
palette = ["#090364", "#091e75", "#093885", "#085396", "#086da6",
"#0888b7", "#08a2c7", "#07bdd8", "#07d7e8", "#07f2f9",
"#f9ac07", "#c77406", "#963b04", "#640303"]
sns.set_style("whitegrid")
sns.set_palette(palette)
plot = sns.scatterplot(df.loc[:,'length'],
df.loc[:,'type'],
hue = df.loc[:,'temperature'],
legend = False,
s = 200)
On the Page Design tab, in the Schemes group, click the More arrow on the color schemes gallery. Click Create new color scheme. In the Create New Color Scheme dialog box, under New, click the arrow next to each color that you want to change, and then select a new color.
You can customize the colors in your heatmap with the cmap parameter of the heatmap() function in seaborn.
The default color palette in seaborn is a qualitative palette with ten distinct hues: sns. color_palette() These colors have the same ordering as the default matplotlib color palette, "tab10" , but they are a bit less intense.
I figured it out. You had to paste the number of colors into the palette:
sns.set_style("whitegrid")
plot = sns.scatterplot(df.loc[:,'length'],
df.loc[:,'type'],
hue = df.loc[:,'temperature'],
palette=sns.color_palette(palette, 14),
legend = False,
s = 200)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With