Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

BaseDrawer.label_for

BaseDrawer.label_for(name, label)[source]

Get the legend label for the given series, with optional overrides.

This method determines the legend label for a series, with optional overrides label and the "label" entry in the series_params option (see options). label is returned if it is not None, as this is the override with the highest priority. If it is None, then the drawer will look for a "label" entry in series_params, for the series identified by name. If this entry doesn’t exist, or is None, then name is used as the label. If all these options are None, then None is returned; signifying that a legend entry for the provided series should not be generated. Note that label_for() will convert name to str when it is returned.

Parameters:
  • name (Union[str, int, float, None]) – The name of the series.

  • label (Union[str, int, float, None]) – Optional label override.

Return type:

Optional[str]

Returns:

The legend entry label, or None.