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

Method for_each_legend

plotly/graph_objs/_figurewidget.py:22662–22694  ·  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

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