曹继东 2019-08-17 16:35
浏览 1117

为什么python绘图时imshow函数和plot画出的子图大小不一致?请大神们指教

fig = plt.figure(figsize=(2.5, 3.53557), dpi=180)
ax1 = fig.add_subplot(711)
norma = mpl.colors.Normalize(vmin=0, vmax=40)
map = ax1.imshow(data112, interpolation='nearest', cmap=cmap, as pect='auto', norm=norma, origin='lower')
font2 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 30}
plt.xlabel('Electron low energy range(1~22MeV)', font2, fontsize=4, labelpad=0.5)
plt.ylabel('Pitch Angle(deg.)', font2, fontsize=3, labelpad=0.1)
plt.xlim(0, 262)
plt.ylim(0, 9)
cb = fig.colorbar(mappable=map, cax=None, ax=ax1, pad=0.01, aspect=2, shrink=1.0, norm=norm, ticks=[0, 10, 20, 30])
cb.set_label('$Counts(cm^-2s^-1Str^-1)$', size=2)
cb.ax.tick_params(labelsize=4, direction='in', right='True')

ax7 = fig.add_subplot(717)
ax7.plot(np.arange(0, len(Electron_counts)), Electron_counts, color='b', label='e', linewidth=0.4)
ax7.plot(np.arange(0, len(Proton_counts)), Proton_counts, color='r', label='p', linewidth=0.4)
plt.legend(bbox_to_anchor=(1.01, 0.5), loc=6, borderaxespad=0, fontsize=4)
font2 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 30}
 plt.xlabel('Electron low energy range(1~22MeV)', font2, fontsize=2, labelpad=0.5)
plt.xlim(0, 262)
plt.ylim(0, 340)
plt.ylabel('$Counts(cm^-2s^-1Str^-1)$', font2, fontsize=2, labelpad=0.5)
plt.yticks([0, 100, 200, 300], ['0', '100', '200', '300'])
plt.show()

图片说明


  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试