Violine Plot with melt

PHOTO EMBED

Thu Apr 21 2022 06:28:10 GMT+0000 (UTC)

Saved by @abhin__dev

# first ten features
data_dia = y
data = x
# standardization
data_n_2 = (data - data.mean()) / (data.std())  
# joinig the data with target variable
data = pd.concat([y,data_n_2.iloc[:,0:10]],axis=1)
# id_vars is the data we want to keep intact
data = pd.melt(data,id_vars="diagnosis",var_name="features",value_name='value')
fig = plt.figure()
ax = fig.add_axes([.1,.1,2,1])
sns.violinplot(x="features", y="value", hue="diagnosis", data=data,split=True, inner="quart")
plt.xticks(rotation=90)
plt.show()
content_copyCOPY