File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -61,18 +61,24 @@ def draw_legend(data, obj):
61
61
if fill_xcolor != "white" : # white is default
62
62
legend_style .append (f"fill={ fill_xcolor } " )
63
63
64
-
65
64
mark_options = []
66
- handles = obj .legendHandles if hasattr (obj , "legendHandles" ) else obj .legend_handles if hasattr (obj , "legend_handles" ) else None
65
+ handles = (
66
+ obj .legendHandles
67
+ if hasattr (obj , "legendHandles" )
68
+ else obj .legend_handles if hasattr (obj , "legend_handles" ) else None
69
+ )
67
70
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" ))
71
+ handles_with_sizes = [handle for handle in handles if hasattr (handle , "_sizes" )]
72
+ all_sizes = set (sz for handle in handles_with_sizes for sz in handle ._sizes )
69
73
if len (all_sizes ) > 1 :
70
- warnings .warn (f"Varying marker sizes in the legend: { all_sizes } . Ignoring all of them." )
74
+ warnings .warn (
75
+ f"Varying marker sizes in the legend: { all_sizes } . Ignoring all of them."
76
+ )
71
77
elif all_sizes :
72
78
mark_size = all_sizes .pop ()
73
79
ff = data ["float format" ]
74
80
# setting half size because pgfplots counts the radius/half-width, and sqrt the area
75
- pgf_size = 0.5 * mark_size ** 0.5
81
+ pgf_size = 0.5 * mark_size ** 0.5
76
82
mark_options .append (f"mark size={ pgf_size :{ff }} " )
77
83
78
84
if mark_options :
You can’t perform that action at this time.
0 commit comments