大佬們好,我有個python畫圖的問題,希望大神們能夠幫忙看看。
代碼的關鍵部分如下
這里D=4, N=24.
for d in D:
m = unit_commitment(d)
pyo.SolverFactory('cbc').solve(m).write()
fig = plt.figure()
ax1 = fig.add_subplot(2, 2, 1)
ax2 = fig.add_subplot(2, 2, 2)
ax3 = fig.add_subplot(2, 2, 3)
ax4 = fig.add_subplot(2, 2, 4)
for n in N:
ax1.bar(Time+1, [sum(m.x[n,t]() for n in N )for t in Time ])
正常會生成4個每天24小時的圖,我想把這四個圖放在一個figure里面,但是我得到的是跟下面這個圖一樣(四個figure,每個figure里四個圖,但是只有第一個有資料,其他都是空白)
求大神指教。感謝!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/80692.html
標籤:其他技術專區
上一篇:小白從java轉go,c語言掌握不深,有沒有大佬可以給一些建議怎么樣學習go
下一篇:關于卡方中文文本特征提取的疑惑
