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

feat: Larger histogram plot if table only has one column #716

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2175,8 +2175,12 @@ def plot_histograms(self, *, number_of_bins: int = 10) -> Image:
n_cols = min(3, self.number_of_columns)
n_rows = 1 + (self.number_of_columns - 1) // n_cols

one_col = n_cols == 1 and n_rows == 1
fig, axs = plt.subplots(n_rows, n_cols, tight_layout=True, figsize=(n_cols * 3, n_rows * 3))
if n_cols == 1 and n_rows == 1:
fig, axs = plt.subplots(1, 1, tight_layout=True)
one_col = True
else:
fig, axs = plt.subplots(n_rows, n_cols, tight_layout=True, figsize=(n_cols * 3, n_rows * 3))
one_col = False

col_names = self.column_names
for col_name, ax in zip(col_names, axs.flatten() if not one_col else [axs], strict=False):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.