Skip to content

Commit 21061b0

Browse files
committed
Fix _sizes lookup
1 parent 9f5afdf commit 21061b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tikzplotlib/_legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ def draw_legend(data, obj):
6464

6565
mark_options = []
6666
handles = obj.legendHandles if hasattr(obj, "legendHandles") else obj.legend_handles if hasattr(obj, "legend_handles") else None
67-
if handles:
68-
all_sizes = set(sz for handle in handles for sz in handle._sizes)
67+
if handles and any(hasattr(handle, "_sizes") for handle in handles):
68+
all_sizes = set(sz for handle in handles for sz in handle._sizes if hasattr(handle, "_sizes"))
6969
if len(all_sizes) > 1:
7070
warnings.warn(f"Varying marker sizes in the legend: {all_sizes}. Ignoring all of them.")
7171
elif all_sizes:

0 commit comments

Comments
 (0)