better slice ticks
This commit is contained in:
parent
4698184ca2
commit
64d4ad0ce0
1 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue