From 64d4ad0ce0f773f7ae31caf697074724fa506d5c Mon Sep 17 00:00:00 2001 From: Mayeul Aubin Date: Wed, 26 Mar 2025 14:15:37 +0100 Subject: [PATCH] better slice ticks --- analysis/slices.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/analysis/slices.py b/analysis/slices.py index 581927d..8b260cc 100644 --- a/analysis/slices.py +++ b/analysis/slices.py @@ -34,7 +34,7 @@ def plot_imshow_with_reference( data_list, elif isinstance(L, int) or isinstance(L, float): L = [L for data in data_list] - sep = 10 if L[0] < 100 else 20 if L[0] < 200 else 100 + sep = 10 if L[0] < 50 else 20 if L[0] < 200 else 100 ticks = [np.arange(0, l+1, sep)*len(dat)/l for l, dat in zip(L,data_list)] tick_labels = [np.arange(0, l+1, sep) for l in L] @@ -86,10 +86,11 @@ def plot_imshow_with_reference( data_list, for i, data in enumerate(data_list): im = axes[i].imshow(data, cmap=cmap, origin='lower', vmin=vmin, vmax=vmax) axes[i].set_title(titles[i], fontsize=fs_titles) - axes[0, i].set_xticks(ticks[i]) - axes[0, i].set_yticks(ticks[i]) - axes[0, i].set_xticklabels(tick_labels[i]) - axes[0, i].set_yticklabels(tick_labels[i]) + axes[i].set_xticks(ticks[i]) + axes[i].set_yticks(ticks[i]) + axes[i].set_xticklabels(tick_labels[i]) + axes[i].set_yticklabels(tick_labels[i]) + axes[i].set_xlabel('Mpc/h') fig.colorbar(im, ax=axes[:], orientation='vertical') return fig, axes @@ -123,7 +124,7 @@ if __name__ == "__main__": fields = [read_field(args.directory+f) for f in args.filenames] if args.index is None: - index = ref_field.N0//2 + index = fields[0].N0//2 else: index=args.index