plotting plineplot with Seaborn excluding certain elements

Asked

Viewed 24 times

0

I would like to plot a lineplot with sns but didn’t want it to plot a specific line

sns.set_palette('Accent')
sns.set_style('darkgrid')

ax = sns.lineplot(x=dados['date'],y=dados['cases'],err_style= None,hue=dados['state'])
ax.figure.set_size_inches(15,6)


ax.set_title("Casos de corona vírus no Brasil" , fontsize=18)
ax.set_xlabel("Tempo" , fontsize=14)
ax.set_ylabel("Casos" , fontsize=14)
ax=ax

in this specific case, I would like the sns plotasse dividing by state , but wanted to exclude the state of São Paulo from the chart

url of data set:https://www.kaggle.com/unanimad/corona-virus-brazil

1 answer

0

Simply remove the lines from the state of São Paulo before plotting:

dados_sem_sp = dados.loc[dados['state'] != 'São Paulo']
ax = sns.lineplot(x=dados_sem_sp['date'], y=dados_sem_sp['cases'], err_style= None, hue=dados_sem_sp['state'])

Browser other questions tagged

You are not signed in. Login or sign up in order to post.