Python:在水平条上并排绘制多个数据集

2024-09-29 19:21:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在同一个图上绘制两个数据集(2007年和2014年),但它们相互重叠。有没有办法让这些条并排显示

fig, ax = plt.subplots()
df07percent.plot.barh(alpha=0.8, color='r', label='2007')
df14percent.plot.barh(alpha=0.8, label='2014')
plt.title('State of WA Church Attendance')
plt.legend()
plt.xlabel('% of Pew Research Survey Respondents', fontsize=12)
plt.show()

enter image description here


Tags: of数据alphaplotfig绘制pltax

热门问题