Seaborn Color

  • Post category:Seaborn

In this Seaborn tutorial, you will learn how to change the seaborn color for plots. 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 bar plot using seaborn
sns.barplot(x = 'species', y = 'sepal_length', data = var, palette = 'Blues')

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

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

# show the plot
plt.show()

Output:

Free resources to learn advanced skills: AiHints and CodeAllow