MCPcopy Index your code
hub / github.com/plotly/plotly.py / for_each_legend

Method for_each_legend

plotly/graph_objs/_figure.py:22658–22690  ·  view source on GitHub ↗

Apply a function to all legend objects that satisfy the specified selection criteria Parameters ---------- fn: Function that inputs a single legend object. selector: dict, function, or None (default None) Dict to use as select

(self, fn, selector=None, row=None, col=None)

Source from the content-addressed store, hash-verified

22656 return self._select_layout_subplots_by_prefix("legend", selector, row, col)
22657
22658 def for_each_legend(self, fn, selector=None, row=None, col=None) -> "Figure":
22659 """
22660 Apply a function to all legend objects that satisfy the
22661 specified selection criteria
22662
22663 Parameters
22664 ----------
22665 fn:
22666 Function that inputs a single legend object.
22667 selector: dict, function, or None (default None)
22668 Dict to use as selection criteria.
22669 legend objects will be selected if they contain
22670 properties corresponding to all of the dictionary's keys, with
22671 values that exactly match the supplied values. If None
22672 (the default), all legend objects are selected. If a
22673 function, it must be a function accepting a single argument and
22674 returning a boolean. The function will be called on each
22675 legend and those for which the function returned True will
22676 be in the selection.
22677 row, col: int or None (default None)
22678 Subplot row and column index of legend objects to select.
22679 To select legend objects by row and column, the Figure
22680 must have been created using plotly.subplots.make_subplots.
22681 If None (the default), all legend objects are selected.
22682 Returns
22683 -------
22684 self
22685 Returns the Figure object that the method was called on
22686 """
22687 for obj in self.select_legends(selector=selector, row=row, col=col):
22688 fn(obj)
22689
22690 return self
22691
22692 def update_legends(
22693 self, patch=None, selector=None, overwrite=False, row=None, col=None, **kwargs

Callers

nothing calls this directly

Calls 2

select_legendsMethod · 0.95
fnFunction · 0.50

Tested by

no test coverage detected