Seaborn.saturate() method



Saturation of a color is defined by the strength of the light and how uniformly it is dispersed over the wavelength spectrum. When only one wavelength is used at extreme intensity, as in laser light, the purest color is produced. The saturation decreases as the intensity decreases.

The Seaborn.saturate() method is used to saturate a color and then this saturated color is returned.

Syntax

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

seaborn.saturate(color)

Parameters

The parameters of this seaborn.saturate() method are given below.

S.No Parameter and Description
1 color

This parameter takes matplotlib color as input and the values include hex, rgb-tuple or an html color name.

Return Value

The return value of this method is an rgb-tuple which contains the saturated color of the color passed.

Example 1

Now we will see how the method works by passing a color to it.

sns.saturate("pink")

Output

The output produced is as follows. An rgb tuple of the color after saturation is given as output.

(1.0, 0.7529411764705882, 0.7960784313725489)

Example 2

In this example we will saturate another color and obtain the saturated color. We can use the palplot method to visualize the rgb tuples sent by the saturate method.

The following line of code can be used to do so.

import seaborn as sns
import matplotlib.pyplot as plt
sns.palplot(sns.saturate("blue"))
plt.show()

Output

The output is as follows,

seaborn_saturate_method

Example 3

We will use the palplot method to visualize a color saturated using the saturate method.

The below line of code can be used to do so.

import seaborn as sns
import matplotlib.pyplot as plt
sns.palplot(sns.saturate("yellow"))
plt.show()

Output

The output is as follows −

saturate_method
seaborn_utility_functions_introduction.htm
Advertisements