Seaborn Color Palette

  • Post category:Seaborn

In this Seaborn tutorial, you will learn how to implement the Seaborn color palette. The palette parameter is used for this task.

# import required modules
import seaborn as sns
import matplotlib.pyplot as plt

# load the dataset
var = sns.load_dataset('iris')

# create a scatter plot using seaborn
sns.scatterplot(x = 'sepal_length', y = 'sepal_width', data = var, hue = 'species', palette = 'Set1')

# set the title of the plot
plt.title('Scatter Plot')

# save the plot
plt.savefig('scatterplot_palette.png')

# show the plot
plt.show()

Output:

Free resources to learn advanced skills: AiHints and CodeAllow