Seaborn.crayon_palette() method



Seaborn.crayon_palette() method is used to make a palette with color names from Crayola crayons. Colors are taken from the Wikipedia page of Crayola crayon colors.

This method is the simple wrapper around the seaborn.crayons dictionary. That is, it returns all the list of colors as RGB tuples in an object that behaves like other seaborn color palettes.

Syntax

Following is the syntax of the seaborn.crayon_palette() method −

seaborn.crayon_palette(colors)

Parameters

The parameters of this method are as follows −

S.No Parameter and Description
1 Colors

Takes a list of strings that are keys in the seaborn.crayons dictionary.

Return Value

This 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.crayon dictionary.

import seaborn as sns
import matplotlib.pyplot as plt
data = sns.crayon_palette(["Sepia","Sunglow","Vivid Violet"])
sns.palplot(data)
plt.show()

Output

The output is as follows −

seaborn_crayon_palette_method

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.crayon_palette(["Wild Watermelon","Wisteria","Wild Strawberry"])
sns.palplot(data)
plt.show()

Output

The output is as follows −

crayon_palette_method

Example 3

In this example, we will pass some other colors and understand the different colors the dictionary has. we have to pass the name sf the keys in the dictionary as arguments. The hex values that are keys’ values cannot be passed.

import seaborn as sns
import matplotlib.pyplot as plt
data = sns.crayon_palette(['Outer Space',"Purple Heart","Vivid Tangerine","Orchid","Raw Sienna"])
sns.palplot(data)
plt.show()

Output

The output is as follows −

crayon_palette
seaborn_color_palettes_introduction.htm
Advertisements