1
When I want the points belonging to different categories to be colored each of a color in the seaborn
, i simply put the categorical variable of interest as argument value hue
. Replicable example:
import seaborn as sns
import random
import pandas as pd
import numpy as np
df = pd.DataFrame({'salario': np.random.pareto(1, size = 100),
'IQ' : np.random.normal(size = 100),
'Sexo' : np.random.binomial(1,0.5,size = 100)
}, index = range(100))
df['Sexo'].replace({0:'Masculino', 1:'Feminino'}, inplace = True)
sns.lmplot('IQ', 'salario', hue = 'Sexo', data = df, fit_reg = False)
I wanted to do it in the matplotlib
, has as?
try this, https://matplotlib.org/gallery/lines_bars_and_markers/scatter_demo2.html#sphx-glr-gallery-Lines-bars-and-markers-scatter-demo2-py
– Elton Nunes