python绘制不同规格的⼦图(subplot)python绘制不同规格的⼦图(subplot)
写在前⾯
当⽤jupyter notebook 写的时候,如果需要单独显⽰图⽚,需要添加
%matplotlib qt
%matplotlib qt
fig = plt.figure()
for file_csv in file:
matplotlib中subplotif'csv' in file_csv and k <15:
k = k +1
read_path = os.path.join(parentfolder,file_csv)
for speed, volume in zip(Speed,Volume):
density, volume_sum,SMS =get_K_V_Q(read_path,speed, volume)
ax1 = plt.subplot2grid((2,2),(0,0),colspan =1)
ax1.scatter(density,volume_sum,c ='b')
ax1.set_ylabel('flow(veh/hour)')
ax2 = plt.subplot2grid((2,2),(1,0),colspan =1)
ax2.scatter(density,SMS,c ='b')
ax2.set_xlabel('density(veh/mile)')
ax2.set_ylabel('speed(mile/hour)')
ax3 = plt.subplot2grid((2,2),(1,1),colspan =1)
ax3.scatter(volume_sum,SMS,c ='b')
ax3.set_xlabel('flow(veh/hour)')
else:
continue
plt._xticklabels(), visible=False)
plt._yticklabels(), visible=False)
plt.show()
fig.savefig('q_v_k.jpg',dpi =300)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论