Dea*_*313 5 matplotlib python-3.x pandas
提出标题中列出的错误,即
“用户警告:未应用紧密布局:子图规范中的列数必须是彼此的倍数”
这是我到目前为止所拥有的代码。本质上,我只是想以比目前更简洁的方式呈现它。清理 DF 的其他建议也值得赞赏!
fig = plt.figure()
ax1 = fig.add_subplot(2, 2, (1,2))
ax2 = fig.add_subplot(224)
ax3 = fig.add_subplot(234)
BC_grouped.plot(ax=ax1)
plt.ylabel("Price")
plt.xlabel("Date")
plt.title("BC_prices")
Gold_grouped.plot(ax=ax2)
plt.ylabel("Price")
plt.xlabel("Date")
plt.title("Gold Prices")
IR_grouped.plot(kind="bar", legend=False,ax=ax3)
plt.ylabel("price")
plt.xlabel("date")
plt.title("Interest_Rates")
fig.tight_layout(pad=3.0);
Run Code Online (Sandbox Code Playgroud)