猿问

matplotlib 子图未显示

右列图没有出现,知道发生了什么吗?我可以将它们堆叠在一起,但是当我尝试制作两列时,右侧的列不显示。另外,当我尝试使用 %matplotlib 笔记本时,该数字完全消失了。我已经包含了我的身材的屏幕截图。

%matplotlib inline


# RING 1 PLOTS


fig, axs = plt.subplots(6, 2)

fig = plt.figure(figsize=(20,20))


axs[0,0].plot(t, ring.IN_1.soma_v, color='black', label='IN soma')

axs[0,0].plot(t, ring.IN_1.dend_prox_v, color='grey', label='IN prox dend')

axs[0,0].plot(t, ring.IN_1.dend_dist_v, color='red', label='IN dist dend')

axs[0,0].plot(t, ring.IN_1.dend_dist2_v, color='blue', label='IN dist2 dend')

axs[0,0].legend(loc='upper right', frameon=False)

axs[0,0].set_ylabel('mV')

axs[0,0].set_xticks([])

axs[0,0].set_xlim([50,300])

axs[0,0].set_ylim([-100,50])


axs[1,0].plot(t, ring.TCcells[0].soma_v, color='black', label='TC1 soma')

axs[1,0].plot(t, ring.TCcells[0].dend_prox_v, color= 'grey', label='TC1 dend')

axs[1,0].legend(frameon = False)

axs[1,0].set_ylabel('mV')

axs[1,0].set_xticks([])

axs[1,0].set_xlim([50,300])

axs[1,0].set_ylim([-100,50])


axs[2,0].plot(t, ring.TCcells[1].soma_v, color='black', label='TC2 soma')

axs[2,0].plot(t, ring.TCcells[1].dend_prox_v, color= 'grey', label='TC2 dend')

axs[2,0].legend(frameon = False)

axs[2,0].set_ylabel('mV')

axs[2,0].set_xticks([])

axs[2,0].set_xlim([50,300])

axs[2,0].set_ylim([-100,50])


axs[3,0].plot(t, ring.TCcells[2].soma_v, color='black', label='TC3 soma')

axs[3,0].plot(t, ring.TCcells[2].dend_prox_v, color= 'grey', label='TC3 dend')

axs[3,0].legend(frameon = False)

axs[3,0].set_ylabel('mV')

axs[3,0].set_xticks([])

axs[3,0].set_xlim([50,300])

axs[3,0].set_ylim([-100,50])


axs[4,0].plot(t, ring.TCcells[3].soma_v, color='black', label='TC4 soma')

axs[4,0].plot(t, ring.TCcells[3].dend_prox_v, color= 'grey', label='TC4 dend')

axs[4,0].legend(frameon = False)

axs[4,0].set_ylabel('mV')

axs[4,0].set_xticks([])

axs[4,0].set_xlim([50,300])

axs[4,0].set_ylim([-100,50])



交互式爱情
浏览 93回答 1
1回答

开满天机

您正在使用plt.show() 两次。删除第一个并在绘制所有图形后plt.show()只使用一次。axs[5,0].set_ylim([-100,50])plt.show()&nbsp; &nbsp; # <------------------ Remove this one# RING 2 PLOTSaxs[0,1].plot(t, ring2.IN_1.soma_v, color='black', label='IN soma')...axs[5,1].set_ylim([-100,50])plt.show()&nbsp; &nbsp; # <------------------ Use only this one也尝试更换fig, axs = plt.subplots(6, 2)fig = plt.figure(figsize=(20,20))经过fig, axs = plt.subplots(6, 2, figsize=(20,20))
随时随地看视频慕课网APP

相关分类

Python
我要回答