Wednesday, June 23, 2021

【PYTHON】Visualization best practices

 # Visualization best practices


df['Genre'].value_counts()[:5].plot.bar()

plt.xlabel('Genre')


# save figure for book

df['Genre'].value_counts()[:5].plot.bar()#figsize=(5.5, 5.5))

plt.savefig('pandas_barplot.png', dpi=300)


df['Genre'].value_counts()[:5]


sns.countplot(y='Genre', data=df, order=df['Genre'].value_counts().index[:5], color='darkblue')


# save figure for book

sns.countplot(y='Genre', data=df, order=df['Genre'].value_counts().index[:5], color='darkblue')

plt.tight_layout()

plt.savefig('seaborn_barplot.png', dpi=300)


# save figure for book

sns.countplot(y='Genre', data=df, order=df['Genre'].value_counts().index[:5])

plt.tight_layout()

plt.savefig('seaborn_barplot_color.png', dpi=300)

No comments:

Post a Comment

End of Summer Sale ☀️😎

20% OFF Inside!🤯 ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏...