<分区> 分区>
我有几个添加了坐标轴的散点图(对输出进行颜色编码),我想将它们放在一个矩阵中(子图)。然而,因为它们已经被砍掉了,我得到了错误:只是倾倒在它下面。向您展示我的意思:
fig1, axes1 = plt.subplots(nrows=4, ncols=2)
scatter1 = df.groupby(['Month', 'Price'])['Quantity'].sum().reset_index()
ax = scatter1[scatter1['Price'] == 460].plot(kind='scatter', x='Month', y='Quantity', color='Blue', label='230HUF');
fig1 = scatter1[scatter1['Price'] == 500].plot(kind='scatter', x = 'Month', y = 'Quantity', color='Yellow', label='250HUF', ax = ax )
scatter2 = df.groupby(['Month', 'Price'])['Quantity'].sum().reset_index()
ax = scatter2[scatter2['Price'] == 460].plot(kind='scatter', x='Month', y='Quantity', color='Blue', label='230HUF');
fig2 = scatter2[scatter2['Price'] == 500].plot(kind='scatter', x = 'Month', y = 'Quantity', color='Yellow', label='250HUF', ax = ax )
fig1.plot(figsize = (25,20),ax=axes1[0,0])
fig2.plot(figsize = (25,20),ax=axes1[0,1])
显示这个:
我想实现的目标:
谢谢!
