- Seaborn Tutorial
- Seaborn - Home
- Seaborn - Introduction
- Seaborn - Environment Setup
- Importing Datasets and Libraries
- Seaborn - Figure Aesthetic
- Seaborn- Color Palette
- Seaborn - Histogram
- Seaborn - Kernel Density Estimates
- Visualizing Pairwise Relationship
- Seaborn - Plotting Categorical Data
- Distribution of Observations
- Seaborn - Statistical Estimation
- Seaborn - Plotting Wide Form Data
- Multi Panel Categorical Plots
- Seaborn - Linear Relationships
- Seaborn - Facet Grid
- Seaborn - Pair Grid
- Function Reference
- Seaborn - Function Reference
- Seaborn Useful Resources
- Seaborn - Quick Guide
- Seaborn - Useful Resources
- Seaborn - Discussion
Seaborn.xkcd_palette() method
The Seaborn.xkcd_palette() method is used to make a palette with color names form the xkcd color survey. (to understand more about this the following link can be visited.
This method is just a simple wrapper around the seaborn.xkcd_rgb dictionary. That is it returns all the list of colors as RGB tuples in an object that behaves like to their seaborn color palettes.
Syntax
Following is the syntax of xkcd_palette() method –
seaborn.xkcd_palette(colors)
Parameters
The parameters of this method are described below.
S.No | Parameter and Description |
---|---|
1 | Colors Takes a list of strings that are keys in the seaborn.xkcd_rgb dictionary. |
Retun Value
The xkcd_palette() method returns a Seaborn color palette.
Example 1
We will have to pass a list of string which are the color names as input and then the colors are produced as a palette as output. The strings should be a part of the seaborn.xkcd_rgb dictionary.
import seaborn as sns import matplotlib.pyplot as plt data = sns.xkcd_palette(["forest green","mauve","teal","indigo"]) sns.palplot(data) plt.show()
Output
The output is as follows −
Example 2
In this example, we will pass some other colors and understand the different colors the dictionary has.
import seaborn as sns import matplotlib.pyplot as plt data = sns.xkcd_palette(["lilac","mauve","pale pink","sage"]) sns.palplot(data) plt.show()
Output
the output is as follows,
Example 3
Let us see another example −
import seaborn as sns import matplotlib.pyplot as plt sns.xkcd_palette(["eggplant","mauve","steel blue","sage"]) sns.palplot(data) plt.show()
Output
The output is as follows −
To Continue Learning Please Login
Login with Google