-
Notifications
You must be signed in to change notification settings - Fork 0
/
z_ta_cont.py
78 lines (58 loc) · 2.45 KB
/
z_ta_cont.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
import numpy as np
# ==================== NUMERICAL ANALYSIS ====================
z_ta_values = np.linspace(1.70, 4.70, 15000, endpoint=True)
y_dag_values = np.linspace(0.48, 1.08, 15000, endpoint=True)
X, Y = np.meshgrid(z_ta_values, y_dag_values)
def z_dag_values(z_ta, y_dag):
return ((1 + z_ta)/y_dag) - 1
variable_grid_data = list((x, y) for x in z_ta_values for y in y_dag_values)
data_points = np.array([z_dag_values(x, y) for (x, y) in variable_grid_data])
new_points = np.reshape(data_points, (len(z_ta_values), len(y_dag_values)))
Z = np.transpose(new_points)
# ==================== PLOT ====================
# LaTeX rendering text fonts
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
# Adjusting the size of the figure
params = {'legend.fontsize': '27',
'axes.labelsize': '44',
'figure.figsize': (15, 10),
'xtick.labelsize': '44',
'ytick.labelsize': '44'}
pylab.rcParams.update(params)
fig, ax0 = plt.subplots()
# --------------------- Contour plot settings
# Set custom colormap range
vmin, vmax = 1.5, 11.5
# Set custom tick levels
levels = np.linspace(vmin, vmax, 10)
contour = plt.contourf(X, Y, Z, levels=levels, cmap='plasma', vmin=vmin, vmax=vmax)
plt.axhline(y=1, color='white', ls='-', lw=3.0, label=r'$y_{\dagger}=1$')
# Colorbar options
cbar = plt.colorbar(contour)
cbar.set_ticks(np.linspace(vmin, vmax, 10))
# Add labels
plt.xlabel(r'$z_{\rm ta}$')
plt.ylabel(r'$y_{\dagger}$')
cbar.set_label(r'$z_{\dagger}$')
# --------------------- Tick settings
ax0.set_xticks([1.7, 2.0, 2.3, 2.6, 2.9, 3.2, 3.5, 3.8, 4.1, 4.4, 4.7])
ax0.set_yticks([0.48, 0.58, 0.68, 0.78, 0.88, 0.98, 1.08])
ax0.xaxis.set_ticks_position('both')
ax0.yaxis.set_ticks_position('both')
ax0.xaxis.set_tick_params(which='major', width=1.5, size=13.0, direction='in')
ax0.xaxis.set_tick_params(which='minor', width=1.0, size=6.50, direction='in')
ax0.yaxis.set_tick_params(which='major', width=1.5, size=13.0, direction='in')
ax0.yaxis.set_tick_params(which='minor', width=1.0, size=6.50, direction='in')
ax0.minorticks_on()
plt.text(1.850, 1.018, r'$\rho_{\Lambda_{\rm s}}(a_{\rm ta}) < 0$', fontsize=36, color='white')
plt.text(1.850, 0.967, r'$\rho_{\Lambda_{\rm s}}(a_{\rm ta}) > 0$', fontsize=36, color='white')
# Other settings
ax0.legend()
plt.tight_layout()
ax0.set_rasterized(True)
# Saving the figure
plt.savefig(r'log\zTurnaroundContour.pdf', format='pdf', dpi=400)
plt.show()