Skip to content

Commit

Permalink
Adjust plot bounds for DataLoader plot grid showing all built-in data…
Browse files Browse the repository at this point in the history
…sets (#243)
  • Loading branch information
stefmolin authored Nov 25, 2024
1 parent e440ee7 commit 694f556
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/data_morph/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='',
)
Expand Down

0 comments on commit 694f556

Please sign in to comment.