Preserve slice titles and colorbar labels in saved figure bounds

This commit is contained in:
2026-09-19 17:05:46 -04:00
parent 07799bca34
commit 2c6523b1ce
2 changed files with 4 additions and 2 deletions

View File

@@ -152,7 +152,7 @@ def main() -> None:
args.output.parent.mkdir(parents=True, exist_ok=True)
paths[0].write_text(json.dumps(report, indent=2, allow_nan=False) + "\n")
for path in paths[1:]:
figure.savefig(path, dpi=200)
figure.savefig(path, dpi=200, bbox_inches="tight", pad_inches=.15)
plt.close(figure)
for path in paths:
print(path)

View File

@@ -215,7 +215,9 @@ def main() -> None:
figure = render(load_slice(args.directory), reference_outline=args.reference_outline, title=args.title, pixels=args.pixels)
output.parent.mkdir(parents=True, exist_ok=True)
for path in paths:
figure.savefig(path, dpi=200)
# Equal physical aspect can leave labels outside the nominal canvas;
# include their extents without changing the axes or field display.
figure.savefig(path, dpi=200, bbox_inches="tight", pad_inches=.15)
print(path)
plt.close(figure)