I have a column in the data set which i represented using a pyplot.hist plot. Using grey color for the bins. There is another column called 'Class' on basis of which i want divide the plot. There are two classes (0 ans 1) in the 'Class' column. I want to represent the class 0 data with grey color and class 1 data with black color. How can this be done
Following is the plot formation i have tried
import matplotlib.pyplot as plt
x= subdf['V12']
y= subdf['Class']
plt.figure(figsize=(25,10))
plt.hist(x,bins=100,color='grey')
plt.show()
How can this be modified to show the two different classes on the plot? Or is there any other plot I can use to achieve my motive easily?
import seborn as sns
import matplotlib.pyplot as plt
fig=sns.FacetGrid(subdf,hue="Class",height=5,palette=["black", "grey"])
fig.map(sns.distplot,"V12")
fig.add_legend()
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With