# Meaning of 'hue" in seaborn barplot

Seaborn barplot has three parameters.

x, y, hue : names of variables in data or vector data, optional

## Question

What is hue? It seems the attribute to plot but why it is called "hue" because when I googled, the result is about color?

Hue - Wikipedia

Hue is one of the main properties (called color appearance parameters) of a color, defined technically (in the CIECAM02 model)

In seaborn, the hue parameter determines which column in the data frame should be used for colour encoding. Using the official document for lmplotprovided an example for this.

import seaborn as sns; sns.set(color_codes=True)
g = sns.lmplot(x="total_bill", y="tip", data=tips)


Adding hue="smoker" tells seaborn you want to colour the data points for smoker and non-smoker differently.

>>> g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data=tips)


How many different values may an indicator have?

e.g. smoker has two (Yes, No).

I am doing data exploratory analysis on some data that I have and I have observed that when the number of values exceeds 6 then I get the following error:

"IndexError: invalid index to scalar variable."


When it's less there are no errors! Any hint!

This is a good question but it seems none of the answers really answered the question.

Simply, in the HSL color system, hue is one of the properties of color which decides what kind of color it looks like, while S and L mean saturation and lightness. Refer to this picture：

Therefore, in seaborn, the hue parameter denotes which column decides the kind of color, i.e. it's red, or green, while the lightness or saturation property may depend on other value columns.

Hue does not have any written limit but if we take a very-very large number then it shows index error. here is the example which shows more than 35 values in hue and does not shown any error.

#Taken haberman breast cancer Dataset
#Columns -> Age , year , axillary_nodes , Survival_status

import seaborn as sns
import matplotlib.pyplot as plt
`