Color encoding (hue)

Seaborn's hue parameter colors elements according to the values of a variable, which adds a categorical dimension to the chart and generates the legend. It is available on most functions. The number of categories should stay limited so that the colors remain distinguishable.

Example

sns.scatterplot(data=df, x='surface', y='prix', hue='ville')

Related concepts

The whole glossary