“PLOT SEABORN” Kode Jawaban

Countplot di panda

>>> import seaborn as sns
>>> sns.set_theme(style="darkgrid")
>>> titanic = sns.load_dataset("titanic")
>>> ax = sns.countplot(x="class", data=titanic)
Lovely Lemur

menampilkan nilai di countplot

plt.figure(figsize=(12,8))
ax = sns.countplot(x="AXLES", data=dfWIM, order=[3,4,5,6,7,8,9,10,11,12])
plt.title('Distribution of Truck Configurations')
plt.xlabel('Number of Axles')
plt.ylabel('Frequency [%]')

for p in ax.patches:
        ax.annotate('%{:.1f}'.format(p.get_height()), (p.get_x()+0.1, p.get_height()+50))
Brave Buffalo

Pairplot Seaborn

>>> import seaborn as sns; sns.set(style="ticks", color_codes=True)
>>> iris = sns.load_dataset("iris")
>>> g = sns.pairplot(iris)
Silly Skylark

PLOT SEABORN

## for single column
sns.countplot(y=df.col)

## for multiple columns
fig, ax = plt.subplots(1, 3, figsize=(25, 10))
fig.suptitle('Count Plot', fontsize=16, y=0.92)

columns = ['Income', 'Age', 'Purchased']
for i, col in enumerate(columns):
    graph = sns.countplot(y=df[col], ax=ax[i])
    ax[i].set_title(*[col])
    graph.bar_label(graph.containers[0])
Darkstar

Countplot untuk kelas yang berbeda di kolom

>>> ax = sns.countplot(x="who", data=titanic, palette="Set3")
Blue Buffalo

Jawaban yang mirip dengan “PLOT SEABORN”

Pertanyaan yang mirip dengan “PLOT SEABORN”

Lebih banyak jawaban terkait untuk “PLOT SEABORN” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya