matlab savefig,MatplotLib'saveFig()'全屏

我用MatplotLib和Cartopy生成了一些数据图像。

问题是,当我将帧大小设置为全屏并使用plt.show()时,图像非常完美,分辨率也很好。

但是,当我使用'plt.savefig()'保存此图时,保存的图像保持其原始大小(不是全屏)。

显示结果图像:

TUnSk.png

yqdX2.png

我的代码如下:

def plot_tec_cartopy(描述文件):

全局矩阵,矩阵,矩阵ax = plt.axes(projection=cartopy.crs.PlateCarree())

v = np.linspace(0, 80, 46, endpoint=True)

cp = plt.contourf(matrixLon, matrixLat, matrixTec, v, cmap=plt.cm.rainbow)

plt.clim(0, 80)

plt.colorbar(cp)

ax.add_feature(cartopy.feature.COASTLINE)

ax.add_feature(cartopy.feature.BORDERS, linestyle=':')

ax.set_extent([-85, -30, -60, 15])

# Setting X and Y labels using LON/LAT format

ax.set_xticks([-85, -75, -65, -55, -45, -35])

ax.set_yticks([-60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15])

lon_formatter = LongitudeFormatter(number_format='.0f',

degree_symbol='',

dateline_direction_label=True)

lat_formatter = LatitudeFormatter(number_format='.0f',

degree_symbol='')

ax.xaxis.set_major_formatter(lon_formatter)

ax.yaxis.set_major_formatter(lat_formatter)

plt.title('Conteúdo Eletrônico Total', style='normal', fontsize='12')

# Acquiring Date

year, julianday = check_for_zero(descfile.split('.')[2]), descfile.split('.')[3]

hour, minute = descfile.split('.')[4], descfile.split('.')[5].replace('h','')

date = datetime.datetime(int(year), 1, 1, int(hour), int(minute)) + datetime.timedelta(int(julianday)-1)

month = date.month

day = date.day

# Set common labels

ax.text(1.22, 1.05, 'TEC', style='normal',

verticalalignment='top', horizontalalignment='right',

transform=ax.transAxes,

color='black', fontsize=11)

ax.text(1, 0.005, 'EMBRACE/INPE', style='italic',

verticalalignment='bottom', horizontalalignment='right',

transform=ax.transAxes,

color='black', fontsize=10)

ax.text(1, 0.995, str(date) + ' UT', style='italic',

verticalalignment='top', horizontalalignment='right',

transform=ax.transAxes,

color='black', fontsize=10)

ax.text(0.5, -0.08, 'Copyright \N{COPYRIGHT SIGN} 2017 INPE - Instituto Nacional de',

style='oblique', transform=ax.transAxes,

verticalalignment='bottom', horizontalalignment='center',

color='black', fontsize=8)

ax.text(0.5, -0.108, 'Pesquisas Espacias. Todos direitos reservados',

style='oblique', transform=ax.transAxes,

verticalalignment='bottom', horizontalalignment='center',

color='black', fontsize=8)

manager = plt.get_current_fig_manager()

manager.resize(*manager.window.maxsize())

figName = 'tec.map' + '.' + str(year) + '.' + str(julianday) + '.' + str(hour) + '.' + str(minute) + 'h.png'

#plt.show()

plt.savefig(figName, dpi=500)

plt.clf()

也许我需要在savefig()中设置一些参数来说明它需要保存我修改过的帧?有人能帮我解决这个问题吗?

提前谢谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值