- 需求
在日常的学习中,有了数据的产生,总要想办法将数据更好的呈现出来,但是绘制图像的方法和种类各式各样,这里把常见的几种方法进行总结
方法一
plt.figure(figsize=(16, 12))
ax = sns.boxplot(data=data, x='Frequency of Purchases', y='Previous Purchases', order = data['Frequency of Purchases'].value_counts().index)
ax.set_title('Previous Purchases by Purchase Frequency')
ax.set_ylabel('Previous Purchases')
ax.set_xlabel('Frequency of Purchases')
ax.set_xticklabels(ax.get_xticklabels(), rotation=0)
plt.show()

ax = item_counts.plot(kind='bar', stacked=True, figsize=(16, 12), colormap='viridis', legend=False)
ax.set_title('Sales Quantity of Different Items in Each Category', fontsize=16)
ax.set_xlabel('Category', fontsize=12)
ax.set_ylabel('Quantity Sold', fontsize=12)
ax.yaxis.get_major_formatter().set_scientific