Improve figure appearance

This commit is contained in:
Yin Li 2020-05-07 19:05:22 -04:00
parent 2c5c4fae2c
commit 8bb6e85c6d
2 changed files with 4 additions and 2 deletions

View File

@ -92,7 +92,7 @@ class FieldDataset(Dataset):
self.pad = np.broadcast_to(pad, (self.ndim, 2)) self.pad = np.broadcast_to(pad, (self.ndim, 2))
assert isinstance(scale_factor, int) and scale_factor >= 1, \ assert isinstance(scale_factor, int) and scale_factor >= 1, \
"only support integer upsampling" 'only support integer upsampling'
self.scale_factor = scale_factor self.scale_factor = scale_factor
self.cache = cache self.cache = cache

View File

@ -28,6 +28,7 @@ def fig3d(*fields, size=64, title=None, cmap=None, norm=None):
nc, nf, nc, nf,
squeeze=False, squeeze=False,
figsize=(nf * im_size, nc * im_size + cbar_height), figsize=(nf * im_size, nc * im_size + cbar_height),
dpi=100,
constrained_layout=True, constrained_layout=True,
) )
@ -93,8 +94,9 @@ def fig3d(*fields, size=64, title=None, cmap=None, norm=None):
fraction=cbar_frac, fraction=cbar_frac,
pad=0, pad=0,
shrink=0.9, shrink=0.9,
aspect=10,
) )
fig.set_constrained_layout_pads(w_pad=3/72, h_pad=3/72, wspace=0, hspace=0) fig.set_constrained_layout_pads(w_pad=2/72, h_pad=2/72, wspace=0, hspace=0)
return fig return fig