Skip to content

Commit

Permalink
Split legend with more than 15 keys into columns
Browse files Browse the repository at this point in the history
closes #757
  • Loading branch information
has2k1 committed Nov 26, 2024
1 parent 6af648b commit e0e971a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doc/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ title: Changelog
- When using [](:class:`~plotnine.geom_text`) with `adjust_text`, some sensible
default arrow properties will be applied.

- Changed the threshold number of keys for when the legend is split into multiple
columns from 20 to 15. This only applies in the default case when the user does
not set the number of rows or columns i.e. `guide_legend(nrow=None, ncol=None).
({{< issue 757 >}})

## v0.14.2
(2024-11-21)

Expand Down
2 changes: 1 addition & 1 deletion plotnine/guides/guide_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def _calculate_rows_and_cols(
if elements.is_horizontal:
nrow = int(np.ceil(nbreak / 5))
else:
ncol = int(np.ceil(nbreak / 20))
ncol = int(np.ceil(nbreak / 15))

if nrow is None:
ncol = cast(int, ncol)
Expand Down

0 comments on commit e0e971a

Please sign in to comment.