Skip to content

Commit 31ffd12

Browse files
authored
feat: Larger histogram plot if table only has one column (#716)
### Summary of Changes - Table.plot_histogram() with only one column is now bigger. - updated Test Image
1 parent 5dd9d02 commit 31ffd12

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/safeds/data/tabular/containers/_table.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,8 +2267,12 @@ def plot_histograms(self, *, number_of_bins: int = 10) -> Image:
22672267
n_cols = min(3, self.number_of_columns)
22682268
n_rows = 1 + (self.number_of_columns - 1) // n_cols
22692269

2270-
one_col = n_cols == 1 and n_rows == 1
2271-
fig, axs = plt.subplots(n_rows, n_cols, tight_layout=True, figsize=(n_cols * 3, n_rows * 3))
2270+
if n_cols == 1 and n_rows == 1:
2271+
fig, axs = plt.subplots(1, 1, tight_layout=True)
2272+
one_col = True
2273+
else:
2274+
fig, axs = plt.subplots(n_rows, n_cols, tight_layout=True, figsize=(n_cols * 3, n_rows * 3))
2275+
one_col = False
22722276

22732277
col_names = self.column_names
22742278
for col_name, ax in zip(col_names, axs.flatten() if not one_col else [axs], strict=False):
1.57 KB
Loading

0 commit comments

Comments
 (0)