Skip to content

Commit

Permalink
fix labeling (#756)
Browse files Browse the repository at this point in the history
Co-authored-by: Boisselet Alexandre (IFAT DC ATV SC D TE2) <Alexandre.Boisselet@infineon.com>
  • Loading branch information
Alexboiboi and Boisselet Alexandre (IFAT DC ATV SC D TE2) committed Apr 11, 2024
1 parent 57b9829 commit 7459fd5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions magpylib/_src/display/traces_utility.py
Expand Up @@ -282,22 +282,23 @@ def get_flatten_objects_properties_recursive(
style = get_style(subobj, default_settings, **kwargs)
if style.label is None:
style.label = str(type(subobj).__name__)
if parent_legendgroup is not None:
legendgroup = parent_legendgroup
else:
legendgroup = f"{subobj}"
legendgroup = f"{subobj}" if parent_legendgroup is None else parent_legendgroup
label = (
get_legend_label(subobj, style=style)
if parent_label is None
else parent_label
)
if parent_color is not None and style.color is None:
style.color = parent_color
elif style.color is None:
style.color = next(color_cycle)
flat_objs[subobj] = {
"legendgroup": legendgroup,
"style": style,
"legendtext": parent_label,
"legendtext": label,
"showlegend": parent_showlegend,
}
if isCollection:
label = get_legend_label(subobj, style=style)
flat_objs.update(
get_flatten_objects_properties_recursive(
*subobj.children,
Expand Down

0 comments on commit 7459fd5

Please sign in to comment.