ugur çapan
ugur çapan

Reputation: 27

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:

enter image description here

Upvotes: 0

Views: 228

Answers (1)

Gautam Chettiar
Gautam Chettiar

Reputation: 459

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

Upvotes: 1

Related Questions