Skip to content

Commit 694f556

Browse files
authored
Adjust plot bounds for DataLoader plot grid showing all built-in datasets (#243)
1 parent e440ee7 commit 694f556

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/data_morph/data/loader.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,17 @@ def plot_available_datasets(cls) -> Axes:
164164
dataset += ' logo'
165165

166166
ax.scatter(points.df.x, points.df.y, s=4, color='black')
167+
168+
# tight plot bounds for the grid of datasets in the docs
169+
bounds = points.data_bounds.clone()
170+
x_offset, y_offset = (offset * 0.1 for offset in bounds.range)
171+
bounds.adjust_bounds(x=x_offset, y=y_offset)
172+
bounds.align_aspect_ratio()
173+
167174
ax.set(
168175
title=f'{dataset} ({points.df.shape[0]:,d} points)',
169-
xlim=points.plot_bounds.x_bounds,
170-
ylim=points.plot_bounds.y_bounds,
176+
xlim=bounds.x_bounds,
177+
ylim=bounds.y_bounds,
171178
xlabel='',
172179
ylabel='',
173180
)

0 commit comments

Comments
 (0)