Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
390 views
unlisted
ubuntu2204
Kernel: Python 3 (system-wide)
import cmocean import numpy as np import h5py import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sns from matplotlib.gridspec import GridSpec from matplotlib.colors import ListedColormap, LinearSegmentedColormap import matplotlib.ticker as mticker import scipy as sp rc = {'figure.figsize':(10,5), 'axes.facecolor':'white', 'axes.grid' : True, 'grid.color': '.8', 'font.size' : 11} plt.rcParams.update(rc)
time07 = np.load('time07.npy') time1 = np.load('time1.npy') time2 = np.load('time2.npy')
eps07_xz = np.load('eps07_xz.npy') eps1_xz = np.load('eps1_xz.npy') eps2_xz = np.load('eps2_xz.npy')
hist07=np.histogram(np.log10(eps07_xz[256:,:]), bins=100, range=(-6,1), density=True) hist1=np.histogram(np.log10(eps1_xz[150:,:]), bins=100, range=(-6,1), density=True) hist2=np.histogram(np.log10(eps2_xz[:,:]), bins=100, range=(-6,1), density=True)
LO07 = np.load('LO07.npy') LO1 = np.load('LO1.npy') LO2 = np.load('LO2.npy') LT07 = np.load('LT07.npy') LT1 = np.load('LT1.npy') LT2 = np.load('LT2.npy') frac07 = np.load('frac07.npy') frac1 = np.load('frac1.npy') frac2 = np.load('frac2.npy')
fig, axis =plt.subplots(1,2,figsize=(8,3)) axs=axis[0] axs2=axis[1] axs.fill_between(time2, np.zeros(time2.shape[0]), frac2*4, color='tab:orange', alpha=0.15) #multiplied by 4 to scale up to the left axis limits axs.fill_between(time1, np.zeros(time1.shape[0]), frac1*4, color='firebrick', alpha=0.2) axs.fill_between(time07, np.zeros(time07.shape[0]), frac07*4, color='midnightblue', alpha=0.3) axt = axs.twinx() axt.set_yticks([0,0.5,1]) axt.grid(False) axt.set_ylabel('$\\mathrm{Overturning\ fraction}$') axs.plot(time07, LO07/LT07, color='midnightblue') axs.plot(time1, LO1/LT1, color='firebrick') axs.plot(time2, LO2/LT2, color='tab:orange') axs.set_xlim(80,150) axs.set_ylim(0,4) axs.set_title('$R_{OT}$') axs.set_xlabel('$t$') axs.annotate('$a)$', (70,4.2), annotation_clip=False, size=12) axt = axs2.twinx() axt.plot(hist07[1][1:], hist07[0], color='midnightblue', label='$\\mathrm{F07}$') axt.plot(hist1[1][1:], hist1[0], color='firebrick', label='$\\mathrm{F1}$') axt.plot(hist2[1][1:], hist2[0], color='tab:orange', label='$\\mathrm{F2}$') axt.set_yscale('log') axt.legend(frameon=False, loc='lower center') axt.set_ylim(0.0001,1) axt.set_xlim(-6,0) axs.axvline(time07[56], color='midnightblue', linestyle='--', linewidth=0.75) axs.axvline(time1[66], color='firebrick', linestyle='--', linewidth=0.75) axs.axvline(time2[52], color='tab:orange', linestyle='--', linewidth=0.75) axt.set_ylabel('$\\mathrm{p.d.f.}$') axs2.set_xlabel('$\\log_{10}\\varepsilon$') axs2.set_yticks([]) axs2.annotate('$b)$', (-6.5,1.05), annotation_clip=False, size=12) fig.tight_layout() fig.show()
/tmp/ipykernel_1295/1694474895.py:12: RuntimeWarning: divide by zero encountered in divide axs.plot(time07, LO07/LT07, color='midnightblue')
Image in a Jupyter notebook