From 18aa574624f188ec274e465401bb7f9a19a15404 Mon Sep 17 00:00:00 2001 From: Janita Willumsen Date: Mon, 1 Jan 2024 15:38:03 +0100 Subject: [PATCH] Clean up script --- python_scripts/colormap_all.py | 53 ++++------------------------------ 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/python_scripts/colormap_all.py b/python_scripts/colormap_all.py index ae19e9b..dc9786b 100644 --- a/python_scripts/colormap_all.py +++ b/python_scripts/colormap_all.py @@ -30,74 +30,31 @@ def plot(): lines = f.readlines() size = int(lines[0]) for i, line in enumerate(lines[1:]): - # Create figures for each plot - # fig1, ax1 = plt.subplots() - # fig2, ax2 = plt.subplots() - # fig3, ax3 = plt.subplots() - arr = line.strip().split("\t") arr = np.asarray(list(map(lambda x: complex(*ast.literal_eval(x)), arr))) # Reshape and transpose array arr = arr.reshape(size, size).T # Plot color maps - color_map1 = axes[0, i].imshow( + axes[0, i].imshow( np.multiply(arr, arr.conj()).real, interpolation="nearest", cmap=sns.color_palette("mako", as_cmap=True) ) - color_map2 = axes[1, i].imshow( + axes[1, i].imshow( arr.real, interpolation="nearest", cmap=sns.color_palette("mako", as_cmap=True) ) - color_map3 = axes[2, i].imshow( + axes[2, i].imshow( arr.imag, interpolation="nearest", cmap=sns.color_palette("mako", as_cmap=True) ) - # Create color bar + # Create tight subplots and save figure fig.subplots_adjust(wspace=0, hspace=0) - # fig.colorbar(color_map1, ax=axes[0, 2]) - # fig.colorbar(color_map2, ax=axes[1, 2]) - # fig.colorbar(color_map3, ax=axes[2, 2]) - - # Remove grids - # for i in range(3): - # axes[i, 0].set_xticks([]) - # axes[i, 0].set_yticks([]) - # axes[i, 0]. - # axes[i, 1].set_xticks([]) - # axes[i, 1].set_yticks([]) - # axes[i, 2].set_xticks([]) - # axes[i, 2].set_yticks([]) - - - # axes[0].set_xticks([]) - # axes[0].set_yticks([]) - # axes[1].set_xticks([]) - # axes[].set_yticks([]) - # axes[].set_xticks([]) - # axes[].set_yticks([]) - - # # Set labels - # ax1.set_xlabel("x-axis") - # ax1.set_ylabel("y-axis") - # ax2.set_xlabel("x-axis") - # ax2.set_ylabel("y-axis") - # ax3.set_xlabel("x-axis") - # ax3.set_ylabel("y-axis") - - # # Save the figures - plt.savefig(f"latex/images/color_map_all.pdf", bbox_inches="tight") - # fig2.savefig(f"latex/images/color_map_{i}_real.pdf", bbox_inches="tight") - # fig3.savefig(f"latex/images/color_map_{i}_imag.pdf", bbox_inches="tight") - - # # Close figures - # plt.close(fig1) - # plt.close(fig2) - # plt.close(fig3) + fig.savefig(f"latex/images/color_map_all.pdf", bbox_inches="tight") if __name__ == "__main__":