Skip to content

Commit

Permalink
feat: Larger histogram plot if table only has one column (#716)
Browse files Browse the repository at this point in the history
### Summary of Changes
- Table.plot_histogram() with only one column is now bigger.
- updated Test Image
  • Loading branch information
SamanHushi committed May 5, 2024
1 parent 5dd9d02 commit 31ffd12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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 @@ -2267,8 +2267,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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31ffd12

Please sign in to comment.