grouped_legend_kwargs¶
yohou.plotting._utils.grouped_legend_kwargs(group_title, entry_name, legend_tracker, *, is_first_in_group)
¶
Build kwargs for a trace that belongs to a titled legend group.
Plotly's legendgrouptitle displays a header above a group of
legend entries. All traces sharing the same legendgroup toggle
together; each trace gets its own visible name in the legend.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
group_title
|
str
|
Title shown above the legend group (e.g. member name |
required |
entry_name
|
str
|
Individual trace label (e.g. |
required |
legend_tracker
|
LegendTracker
|
De-duplicates entries across subplots. |
required |
is_first_in_group
|
bool
|
When |
required |
Returns¶
| Type | Description |
|---|---|
dict
|
Ready-to-unpack kwargs for |
Examples¶
>>> tracker = LegendTracker()
>>> grouped_legend_kwargs("sensor_a", "mean", tracker, is_first_in_group=True)
{'legendgroup': 'sensor_a', 'showlegend': True, 'name': 'mean', 'legendgrouptitle': {'text': 'sensor_a'}}
>>> grouped_legend_kwargs("sensor_a", "std", tracker, is_first_in_group=False)
{'legendgroup': 'sensor_a', 'showlegend': True, 'name': 'std'}
See Also¶
linked_legendgroup_kwargs : Build kwargs for linked (ungrouped) legend entries.
[LegendTracker][yohou.plotting._utils.LegendTracker] : Track which legend entries have been shown.