#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Jul 6 12:18:06 EDT 2023 if __name__ == '__main__': import sys,os from misc.timer import Timer tt = Timer(f'[{os.getcwd()}] start ' + ' '.join(sys.argv)) import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd, matplotlib.pyplot as plt #more imports wython = '/tigress/wenchang/wython' if wython not in sys.path: sys.path.append(wython); print('added to python path:', wython) #from misc import get_kws_from_argv from fig_bars_eta import wyplot as plot_bars_eta#, wyplot_gap_explained as plot_gap_explained # if __name__ == '__main__': tt.check('end import') # #start from here if __name__ == '__main__': from wyconfig import * #my plot settings single_panel = True if '1' in sys.argv else False if single_panel: #single panel: only plot_bars_eta fig, ax = plt.subplots() plot_bars_eta(ax) ax.set_xlabel('') else: #double panels figsize = 6, 6.5 fig, axes = plt.subplots(2, 1, figsize=figsize) ax = axes[0] plot_bars_eta(ax) #ax.set_title('(a)') ax.text(0, 1, ' (a)', ha='left', va='top', transform=ax.transAxes, fontsize='large') ax = axes[1] plot_bars_eta(ax, eta_type='tmsst') #plot_gap_explained(ax=ax) #ax.set_title('(b)') ax.text(0, 1, ' (b)', ha='left', va='top', transform=ax.transAxes, fontsize='large') for ax in axes: ax.set_xlabel('') #savefig if 'savefig' in sys.argv or 's' in sys.argv: figname = __file__.replace('.py', f'.png') if 'overwritefig' in sys.argv or 'o' in sys.argv: wysavefig(figname, overwritefig=True) else: wysavefig(figname) tt.check(f'**Done**') print() if 'notshowfig' in sys.argv or 'n' in sys.argv: pass else: if 'plt' in globals(): plt.show()