From 8d06cb44b147c494d472f00f7355703e7c662f01 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:27:37 +1100 Subject: [PATCH] Adjust plot bounds for DataLoader plot grid showing all built-in datasets --- src/data_morph/data/loader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/data_morph/data/loader.py b/src/data_morph/data/loader.py index cb625824..89c8bb95 100644 --- a/src/data_morph/data/loader.py +++ b/src/data_morph/data/loader.py @@ -164,10 +164,17 @@ def plot_available_datasets(cls) -> Axes: dataset += ' logo' ax.scatter(points.df.x, points.df.y, s=4, color='black') + + # tight plot bounds for the grid of datasets in the docs + bounds = points.data_bounds.clone() + x_offset, y_offset = (offset * 0.1 for offset in bounds.range) + bounds.adjust_bounds(x=x_offset, y=y_offset) + bounds.align_aspect_ratio() + ax.set( title=f'{dataset} ({points.df.shape[0]:,d} points)', - xlim=points.plot_bounds.x_bounds, - ylim=points.plot_bounds.y_bounds, + xlim=bounds.x_bounds, + ylim=bounds.y_bounds, xlabel='', ylabel='', )