Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Seaborn does not show the bar graphics and others

I am learning Data Science and I am trying to figure out why I see this difference.
What I get:

import seaborn as sns
import matplotlib.pyplot as plt

from pandas.api.types import CategoricalDtype
diamonds = sns.load_dataset('diamonds')
df= diamonds.copy()
cut_categoriler= ["fair","good","very good","premium","ideal"]
df.cut= df.cut.astype(CategoricalDtype(categories = cut_categoriler, ordered= True))
df.head().T

sns.catplot(x= "cut" ,y= "price",data =df);
plt.show()

enter image description here

what I want:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

Don’t do the cut operation that you are doing. The plot is pretty straightforward.

import seaborn as sns
import matplotlib.pyplot as plt

from pandas.api.types import CategoricalDtype
diamonds = sns.load_dataset('diamonds')
df= diamonds.copy()
df.head()

sns.catplot(x= "cut" ,y= "price",data = df);
plt.show()

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading