Skip to content

Commit

Permalink
allow styling cat legend
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Milk committed Oct 11, 2022
1 parent a0ca305 commit 6e97a66
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion legendkit/_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ class CatLegend(ListLegend):
labels : array-like
The text for each legend item
handle : optional, str or handle object
handler_kw : mapping
Use this to control the style of handler
size : str or number, {"small", "medium", "large"}
The size of legend handle
kwargs :
Expand Down Expand Up @@ -281,12 +283,16 @@ def __init__(self,
labels=None,
size="medium",
handle=None,
handle_kw=None,
**kwargs
):
if handle is None:
handle = 'square'
if handle_kw is None:
handle_kw = {}

legend_items = [(handle, name, {'color': c}) for c, name in
legend_items = [(handle, name,
{'color': c, **handle_kw}) for c, name in
zip(colors, labels)]
if isinstance(size, str):
size = self._sizer[size]
Expand Down

0 comments on commit 6e97a66

Please sign in to comment.