...
/Adding the hue Parameter for Color Encoding
Adding the hue Parameter for Color Encoding
Learn how to use the hue parameter for categorical variables in different plots.
We'll cover the following...
Why do we need the hue
parameter in plots?
A variety of seaborn plots (including scatter plots and pair plots) solely plot the numerical variables while excluding the categorical variables. These may be helpful when the only variables in the data are numerical. However, categorical variables frequently convey more insights and patterns in the data.
Seaborn’s hue
parameter, accessible for practically all seaborn plots, solves this problem.
In seaborn, the hue
parameter is used for color encoding. We can pass any categorical variable to the hue
parameter, resulting in different color codes for each unique category of the categorical variable. As a result, we can use categorical variables for color encoding, even for plots that are built solely on numerical data.
Use hue parameter in plots
We begin by importing the iris
dataset ...