diff --git a/Figures/Fig1/fig1.pdf b/Figures/Fig1/fig1.pdf index d29fb2f..0c6adda 100644 Binary files a/Figures/Fig1/fig1.pdf and b/Figures/Fig1/fig1.pdf differ diff --git a/Figures/Fig1/fig1.png b/Figures/Fig1/fig1.png index d8c9bc6..f10d0eb 100644 Binary files a/Figures/Fig1/fig1.png and b/Figures/Fig1/fig1.png differ diff --git a/Figures/Fig2/fig2.pdf b/Figures/Fig2/fig2.pdf index f5a6878..6af3094 100644 Binary files a/Figures/Fig2/fig2.pdf and b/Figures/Fig2/fig2.pdf differ diff --git a/Figures/Fig2/fig2.png b/Figures/Fig2/fig2.png index 8c66c33..6464ca0 100644 Binary files a/Figures/Fig2/fig2.png and b/Figures/Fig2/fig2.png differ diff --git a/Figures/Fig3/fig3.pdf b/Figures/Fig3/fig3.pdf index b1d6c92..d8ccace 100644 Binary files a/Figures/Fig3/fig3.pdf and b/Figures/Fig3/fig3.pdf differ diff --git a/Figures/Fig3/fig3.png b/Figures/Fig3/fig3.png index 057ca66..cc9d901 100644 Binary files a/Figures/Fig3/fig3.png and b/Figures/Fig3/fig3.png differ diff --git a/fig_settings.py b/fig_settings.py index 4adf0d4..c2cde7e 100644 --- a/fig_settings.py +++ b/fig_settings.py @@ -13,9 +13,11 @@ # color styling def set_colors(n_colors=2): global cmap + global auroc_cmap global pallette cmap = "cmr.redshift" qualitative_cmap = cmr.get_sub_cmap(cmap, 0.2, 0.8, N=n_colors) + auroc_cmap = cmr.get_sub_cmap(cmap, 0.5, 1) pallette = qualitative_cmap.colors mpl.rcParams["axes.prop_cycle"] = mpl.cycler(color=pallette) diff --git a/plot_fig1.py b/plot_fig1.py index c55d1e9..4e831b5 100644 --- a/plot_fig1.py +++ b/plot_fig1.py @@ -35,8 +35,8 @@ ax1.set_position([0, 0.4, 0.45, 0.75]) ax1.text( - 0.025, - 0.775, + 0.01, + 0.79, "(a)", transform=ax1.transAxes, fontsize=13, @@ -111,7 +111,7 @@ ax2 = fig.add_subplot(gs[1]) ax2.text( -0.39, - 1.1, + 1.13, "(b)", transform=ax2.transAxes, fontsize=12, @@ -140,7 +140,7 @@ err_c1 = np.zeros((2, n)) for i in range(n): - interval = az.hdi(c1_samples[:, i], hdi_prob=0.95) + interval = az.hdi(c1_samples[:, i], hdi_prob=0.5) x, y = interval err_c1[0, i] = max(c1_mean[i] - x, 0) err_c1[1, i] = max(y - c1_mean[i], 0) @@ -165,7 +165,7 @@ err_c2 = np.zeros((2, n)) for i in range(n): - interval = az.hdi(c2_samples[:, i], alpha=0.05, roundto=4) + interval = az.hdi(c2_samples[:, i], hdi_prob=0.5) x, y = interval err_c2[0, i] = max(c2_mean[i] - x, 0) err_c2[1, i] = max(y - c2_mean[i], 0) @@ -203,8 +203,8 @@ """ ax3 = fig.add_subplot(gs[2]) ax3.text( - -0.35, - 1.05, + -0.37, + 1.11, "(c)", transform=ax3.transAxes, fontsize=12, @@ -219,12 +219,12 @@ tmax = np.array(data["tmax"], dtype=float) performance = np.array(data[measure], dtype=float) -ax3.semilogx(tmax, performance[0].mean(axis=1), color="C0", label="Simple") -ax3.semilogx(tmax, performance[1].mean(axis=1), color="C1", label="Complex") -min_idx = np.where((performance[0].mean(axis=1) - performance[1].mean(axis=1)) < 0)[ +ax3.semilogx(tmax, np.median(performance[0], axis=1), color="C0", label="Simple") +ax3.semilogx(tmax, np.median(performance[1], axis=1), color="C1", label="Complex") +min_idx = np.where((np.median(performance[0], axis=1) - np.median(performance[1], axis=1)) < 0)[ 0 ].min() -max_idx = np.where((performance[0].mean(axis=1) - performance[1].mean(axis=1)) < 0)[ +max_idx = np.where((np.median(performance[0], axis=1) - np.median(performance[1], axis=1)) < 0)[ 0 ].max() print(tmax[min_idx]) @@ -233,7 +233,7 @@ hdi_a = np.zeros_like(tmax) hdi_b = np.zeros_like(tmax) for i in range(len(tmax)): - interval = az.hdi(performance[0, i], hdi_prob=0.95) + interval = az.hdi(performance[0, i], hdi_prob=0.5) a, b = interval hdi_a[i] = a hdi_b[i] = b @@ -243,14 +243,14 @@ hdi_a = np.zeros_like(tmax) hdi_b = np.zeros_like(tmax) for i in range(len(tmax)): - interval = az.hdi(performance[1, i], hdi_prob=0.95) + interval = az.hdi(performance[1, i], hdi_prob=0.5) a, b = interval hdi_a[i] = a hdi_b[i] = b ax3.fill_between(tmax, hdi_a, hdi_b, alpha=0.3, color="C1", edgecolor="none") ax3.set_ylabel(measure.upper()) -ax3.set_xlabel(r"$t_{\mathregular{max}}$") +ax3.set_xlabel(r"Time series length, $T$") ax3.set_xlim([10, 10**4]) ax3.set_xticks( [10, 100, 1000, 10000], @@ -261,8 +261,8 @@ r"$\mathregular{10^4}$", ], ) -ax3.set_ylim([0, 1]) -ax3.set_yticks([0, 0.5, 1], [0, 0.5, 1]) +ax3.set_ylim([0.45, 1]) +ax3.set_yticks([0.5, 1], [0.5, 1]) ax3.legend( loc="lower right", @@ -280,7 +280,7 @@ ax4 = fig.add_subplot(gs[3]) ax4.text( -0.38, - 1.05, + 1.11, "(d)", transform=ax4.transAxes, fontsize=12, @@ -300,11 +300,11 @@ np.fliplr(to_imshow_orientation(mean_performance)), extent=(min(frac), max(frac), max(beta), min(beta)), aspect="auto", - cmap=cmap, - vmin=0, + cmap=fs.auroc_cmap, + vmin=0.5, vmax=1, ) -ax4.set_xlabel(r"Complexity, $\lambda$") +ax4.set_xlabel(r"Complexity, $\omega$") ax4.set_ylabel(r"Infectivity, $\beta$") ax4.set_xticks([0, 0.5, 1], [0, 0.5, 1]) @@ -312,8 +312,8 @@ cbar_ax = fig.add_axes([0.91, 0.15, 0.015, 0.31]) # x, y, width, height cbar = plt.colorbar(c, cax=cbar_ax) -cbar.set_label(measure.upper(), fontsize=axislabel_fontsize, rotation=270, labelpad=10) -cbar_ax.set_yticks([0, 1], [0, 1], fontsize=tick_fontsize) +cbar.set_label(measure.upper(), fontsize=axislabel_fontsize, rotation=270, labelpad=0) +cbar_ax.set_yticks([0.5, 1], [0.5, 1], fontsize=tick_fontsize) plt.savefig("Figures/Fig1/fig1.png", dpi=1000) plt.savefig("Figures/Fig1/fig1.pdf", dpi=1000) diff --git a/plot_fig2.py b/plot_fig2.py index 5beb064..e705d2a 100644 --- a/plot_fig2.py +++ b/plot_fig2.py @@ -31,7 +31,7 @@ ] keys = ["p", "alpha", "size"] titles = ["Erdös-Rényi", "Power-law CM", "Clustered"] -labels = [r"$p$", r"$\alpha$", r"$s$"] +labels = [r"Density, $p$", r"Exponent $\alpha$", r"Clique size $s$"] xticks = [ [0, 0.5, 1], [-4, -3, -2], @@ -116,7 +116,7 @@ def visualize_networks(i, ax): ax.plot(var, r0 * beta_c, "-", linewidth=0.25, color="grey") if i == 0: - ax.set_ylabel(r"$\beta$") + ax.set_ylabel(r"Infectivity, $\beta$") else: ax.set_yticks([], []) @@ -144,7 +144,7 @@ def visualize_networks(i, ax): ax.set_yticks([0, 0.5, 1], [0, 0.5, 1]) if i == 0: - ax.set_ylabel(r"$\beta$") + ax.set_ylabel(r"Infectivity,$\beta$") else: ax.set_yticks([], []) diff --git a/plot_fig3.py b/plot_fig3.py index 75bdfc3..3a13170 100644 --- a/plot_fig3.py +++ b/plot_fig3.py @@ -9,16 +9,8 @@ import fig_settings as fs from lcs import * -axislabel_fontsize = 12 -tick_fontsize = 12 -fs.set_fonts( - { - "font.family": "serif", - "axes.labelsize": axislabel_fontsize, - "xtick.labelsize": tick_fontsize, - "ytick.labelsize": tick_fontsize, - } -) + +fs.set_fonts() with open(f"Data/zkc_tmax_comparison.json") as file: data = json.load(file) @@ -52,7 +44,7 @@ x = tmax -plt.figure(figsize=(5.5, 5)) +plt.figure(figsize=(4, 3.5)) core_values = np.unique(coreness) @@ -61,7 +53,7 @@ y = node_performance_complex[coreness == k] - node_performance_simple[coreness == k] # combine first and last axes. y = np.array([y[i, :, j] for i in range(n_k) for j in range(n_r)]).T - ymean = y.mean(axis=1) + ymean = np.median(y, axis=1) hdpi_a = np.zeros_like(tmax) hdpi_b = np.zeros_like(tmax) @@ -77,7 +69,7 @@ markersize=ms, color=clist[idx], alpha=alpha, - label=f"{int(k)}-core nodes", + label=f"{int(k)}-core", ) plt.fill_between(x, hdpi_a, hdpi_b, color=clist[idx], alpha=0.1) @@ -98,7 +90,7 @@ plt.legend(frameon=False, loc="upper left") plt.ylabel(r"$\Delta\,\phi_i$") -plt.xlabel(r"$t_{\max}$") +plt.xlabel(r"$T$") sns.despine() plt.tight_layout()