Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust plot bounds for DataLoader plot grid showing all built-in datasets #243

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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