Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)

Can anyon tell me what is hue in seaborn?

1 Answer

0 votes
by (119k points)

In seaborn, the hue parameter represents which column in the data frame, you want to use for color encoding. The example shown here is from the official document for lmplot:

import seaborn as sns; sns.set(color_codes=True)

tips = sns.load_dataset("tips")

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

Adding `hue="smoker" represent that you want to use “smoker” for color encoding i.e. color the data points for smoker and non-smoker differently.

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

 

To learn data visualization using Python, you can check out this Python Course by Intellipaat.

Also, you can watch this video on Python using Seaborn to know more:

Related questions

0 votes
1 answer
asked Oct 21, 2019 in Big Data Hadoop & Spark by Kartik12234 (11.9k points)
0 votes
1 answer
asked Oct 5, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Oct 5, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Oct 5, 2020 in Python by Sudhir_1997 (55.6k points)
0 votes
1 answer

Browse Categories

...