#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed Feb 10 13:53:50 EST 2021 if __name__ == '__main__': from misc.timer import Timer tt = Timer(f'start {__file__}') import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd import matplotlib.pyplot as plt #more imports # if __name__ == '__main__': tt.check('end import') # #start from here #subplot images cde = 'fig_lines_tc_liz_lmr2019_2021-02-11.png' ff = 'fig_heatmap_corr_liz_lmr2019_2021-02-12.png' aa = 'fig_map_sites.png' bb = 'fig_dots_sites.png' def labelax(ax, label, x=0, y=1): ax.text(x, y, label, transform=ax.transAxes, ha='right', va='bottom', fontweight='bold')#, fontsize='large') if __name__ == '__main__': from wyconfig import * #my plot settings import matplotlib.image as image, matplotlib.gridspec as gridspec fig = plt.figure(figsize=(8,4)) gs = fig.add_gridspec(6,10) ax1 = fig.add_subplot(gs[:, 5:]) ax = ax1 img = image.imread(cde) ax.imshow(img) ax.axis('off') labelax(ax, 'c') labelax(ax, 'd', y=0.67) labelax(ax, 'e', y=0.35) ax4 = fig.add_subplot(gs[3:, 0:5]) ax = ax4 img = image.imread(ff) ax.imshow(img) ax.axis('off') labelax(ax, 'f') ax5 = fig.add_subplot(gs[0:3, 0:2]) ax = ax5 img = image.imread(aa) ax.imshow(img) ax.axis('off') labelax(ax, 'a') ax6 = fig.add_subplot(gs[0:3, 2:5]) ax = ax6 img = image.imread(bb) ax.imshow(img) ax.axis('off') labelax(ax, 'b') figname = __file__.replace('.py', f'_{tt.today()}.png') if len(sys.argv) > 1 and sys.argv[1] == 'savefig': plt.savefig(figname, dpi=300) print('[saved]:', figname) tt.check(f'**Done**') plt.show()