Seaborn barplot has three parameters.

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


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)
tips = sns.load_dataset("tips")
g = sns.lmplot(x="total_bill", y="tip", data=tips)

enter image description here

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)

enter image description here

| improve this answer | |

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!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.