EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Seaborn Tutorial Seaborn Palette
Secondary Sidebar
Seaborn Tutorial
  • Seaborn Basic and Advanced
    • Seaborn
    • Seaborn Histogram
    • Seaborn heatmap
    • Seaborn barplot
    • Seaborn Scatter Plot
    • Seaborn Countplot
    • Seaborn regplot
    • Seaborn Catplot
    • Seaborn Legend
    • Seaborn jointplot
    • Seaborn Figure Size
    • Seaborn Time Series
    • Seaborn Heatmap Size
    • Seaborn Graphs
    • Seaborn Palette
    • Seaborn Subplots
    • Seaborn Line Plot
    • Seaborn Pairplot
    • Seaborn Boxplot
    • Seaborn Color Palette
    • Seaborn Violin Plot
    • Seaborn Styles
    • Seaborn Implot
    • Seaborn Kdeplot
    • Seaborn Multiple Plots
    • Seaborn Distribution Plot
    • Seaborn Bar Chart
    • Seaborn 3D Plot
    • Seaborn Stacked Bar Plot
    • Seaborn Datasets
    • Seaborn Correlation Heatmap

Seaborn Palette

Introduction to Seaborn Palette

Seaborn palette makes easy-to-use colors suited to the data characteristics and the goals of visualization. It is used to color the plot; by using the palette, we can generate different colors. Color plays an essential role in an aspect of visualizations at the time we are using the same efficiently. The seaborn color palette adds more value to the specified plot.

Seaborn Palette

Key Takeaways

  • The color palette provides the interface in many possible ways; we can generate colors by using seaborn and the same by using function.
  • By using the color palette, we are accepting the seaborn palette. It will also be taking the list of colors in matplotlib format.

Overview of Seaborn Palette

At the time of creating the visualization of data, our main aim is to communicate the insights for finding the data. While visualizing the necessary information, styling will influence the audience. After formatting the data for visualization, the next step in data visualization is styling. In seaborn, styling is the process used to customize the visualization look. The decision of details visualization increases the impact of our work. We can build a color palette by using the function name color_palette. The color palette function takes any built-in palette; we can create our palette.

Create Colors Seaborn Palette

Seaborn contains 170 different types of palettes available. We can access the palette list by importing the seaborn package.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,408 ratings)

In the below example, we are importing the seaborn package by using the import keyword as follows:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Code:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

Output:

importing the seaborn package

In the example below, we are using a palette value as “d,” which will show an error because d is not a palette value.

Code:

sns.pairplot(df, hue='total_bill', palette='d')

Output:

using a palette value as "d

Below image shows the list of palette values which was supported in python as follows:

list of palette values

Below example shows the palette as follows:

We are defining one by one palette examples as follows:

1. Accent_r

Code:

sns.pairplot(df, hue='total_bill', palette='Accent_r')
plt.show()

Output:

Accent_r

2. Accent

Code:

sns.pairplot(df, hue='total_bill', palette='Accent')
plt.show()

Output:

Seaborn Palette - Accent

3. Blues

Code:

sns.pairplot(df, hue='total_bill', palette='Blues')
plt.show()

Output:

Seaborn Palette - Blues

4. Blues_r

Code:

sns.pairplot(df, hue='total_bill', palette='Blues_r')
plt.show()

Output:

Seaborn Palette - Blues_r

5. BrBG

Code:

sns.pairplot(df, hue='total_bill', palette='BrBG')
plt.show()

Output:

BrBG

6 BrBG_r

Code:

sns.pairplot(df, hue='total_bill', palette='BrBG_r')
plt.show()

Output:

BrBG_r

7. BuGn

Code:

sns.pairplot(df, hue='total_bill', palette='BuGn')
plt.show ()

Output:

Seaborn Palette - BuGn

8. BuGn_r

Code:

sns.pairplot(df, hue='total_bill', palette='BuGn_r')
plt.show()

Output:

Seaborn Palette - BuGn_r

9. BuPu

Code:

sns.pairplot(df, hue='total_bill', palette='BuPu')
plt.show()

Output:

Seaborn Palette - BuPu

10. BuPu_r

Code:

sns.pairplot(df, hue='total_bill', palette='BuPu_r')
plt.show()

Output:

Seaborn Palette - BuPu_r

11. CMRmap

Code:

sns.pairplot(df, hue='total_bill', palette='CMRmap')
plt.show()

Output:

CMRmap

12. CMRmap_r

Code:

sns.pairplot(df, hue='total_bill', palette='CMRmap_r')
plt.show()

Output:

CMRmap_r

13. Dark2

Code:

sns.pairplot(df, hue='total_bill', palette='Dark2')
plt.show()

Output:

Dark2

14. Dark2_r

Code:

sns.pairplot(df, hue='total_bill', palette='Dark2_r')
plt.show()

Output:

Dark2_r

15. GnBu

Code:

sns.pairplot(df, hue='total_bill', palette='GnBu')
plt.show()

Output:

GnBu

16. GnBu_r

Code:

sns.pairplot(df, hue='total_bill', palette='GnBu_r')
plt.show()

Output:

Seaborn Palette - GnBu_r

17. Greens

Code:

sns.pairplot(df, hue='total_bill', palette='Greens')
plt.show()

Output:

Greens

18. Greens_r

Code:

sns.pairplot(df, hue='total_bill', palette='Greens_r')
plt.show()

Output:

Seaborn Palette - Greens_r

19. Greys

Code:

sns.pairplot(df, hue='total_bill', palette='Greys')
plt.show()

Output:

Seaborn Palette - Greys

20. Greys_r

Code:

sns.pairplot(df, hue='total_bill', palette='Greys_r')
plt.show ()

Output:

Greys_r

21. OrRd

Code:

sns.pairplot(df, hue='total_bill', palette='OrRd')
plt.show()

Output:

OrRd

22. OrRd_r

Code:

sns.pairplot(df, hue='total_bill', palette='OrRd_r')
plt.show()

Output:

OrRd_r

23. Oranges

Code:

sns.pairplot(df, hue='total_bill', palette='Oranges')
plt.show()

Output:

Oranges

24. Oranges_r

Code:

sns.pairplot(df, hue='total_bill', palette='Oranges_r')
plt.show()

Output:

Oranges_r

Seaborn Palette Categorical

Seaborn is the more critical visualization package in python. The seaborn package contains robust controls and beautiful colors for a wide plot array parameter. In python data visualization, colors are essential and necessarily involved; color influences the observer.

Using the scatterplot, we use color encoding for the different data sets.

In the following example, we are using the iris dataset for the seaborn repository as follows:

Code:

import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('iris')
sns.lmplot ( x="sepal_length", legend=False)
plt.legend(loc = 'lower right')
plt.show()

Output:

iris dataset for the seaborn repository

In seaborn, it is also possible to define the maker shapes in a different category; we can use the argument function of markers.

Code:

import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset('iris')
sns.lmplot( x="sepal_length", markers=["o", "x", "1"])
plt.legend(loc='lower right')
plt.show()

Output:

argument function of markers

Seaborn Palette Custom Colors

We know that seaborn is the library based on a matplotlib. We need to create our custom data to use the palette’s custom colors.

Below example shows to create custom data as follows:

Code:

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = np.array (…)
dataset = pd.DataFrame( … )
print (dataset)

Output:

create custom data

The below example shows to use of the existing palette. Seaborn and matplotlib contain multiple color palettes.

In the below example, we are using the paired palette as follows:

Code:

sns.set_palette(sns.color_palette ("Paired"))
plt.show()

Output:

using the paired palette

In the below example, we are using our color palette as follows. We are using a particular set of colors to define a custom color palette in seaborn.

Code:

sns.set_palette(sns.color_palette(colors))
plt.show()

Output:

custom color palette in seaborn

FAQ

Other FAQs are mentioned below:

Q1. What is the use of the seaborn palette in python?

Answer:

By using it, we can color the plot. By using the palette, we can generate different types of colors.

Q2. What is a custom seaborn palette in python?

Answer:

It is nothing, but we are creating our custom color palette and using the same in our code.

Q3. What are circular color systems in the seaborn palette?

Answer:

At the time, we used categories of arbitrary numbers without distinguishing the others; it was the easiest way to draw circular color systems.

Conclusion

The decision of details visualization increased the impact of our work. We can build a color palette by using the function name color_palette. Color plays an essential role in an aspect of visualizations at the time we are using the same efficiently. Seaborn’s color palette adds more value to the specified plot.

Recommended Articles

This is a guide to Seaborn Palette. Here we discuss the introduction, create colors, seaborn palette, categorical, custom colors, and FAQ. You may also have a look at the following articles to learn more –

  1. Seaborn barplot
  2. Seaborn heatmap
  3. Seaborn Scatter Plot
  4. Seaborn Histogram
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more