LegendConfig#

class pyopenms_viz._config.LegendConfig(*, loc: str = 'right', orientation: str = 'vertical', title: str = 'Legend', fontsize: int = 10, show: bool = True, onClick: Literal['hide', 'mute'] = 'mute', bbox_to_anchor: Tuple[float, float] = (1.2, 0.5), ncol: int = 1)#

Bases: BaseConfig

Configuration for the legend in a plot.

Parameters:
  • loc (str) – Location of the legend. Defaults to “right”.

  • orientation (str) – Orientation of the legend. Defaults to “vertical”.

  • title (str) – Title of the legend. Defaults to “Legend”.

  • fontsize (int) – Font size of the legend text. Defaults to 10.

  • show (bool) – Whether to show the legend. Defaults to True.

  • onClick (Literal["hide", "mute"]) – Action on legend click. Only valid for Bokeh. Defaults to “mute”.

  • bbox_to_anchor (Tuple[float, float]) – Fine control for legend positioning in Matplotlib. Defaults to (1.2, 0.5).

Returns:

An instance of LegendConfig.

Return type:

LegendConfig

__eq__(other)#

Return self==value.

__init__(*, loc: str = 'right', orientation: str = 'vertical', title: str = 'Legend', fontsize: int = 10, show: bool = True, onClick: Literal['hide', 'mute'] = 'mute', bbox_to_anchor: Tuple[float, float] = (1.2, 0.5), ncol: int = 1) None#
__repr__()#

Return repr(self).

static _matplotlibLegendLocationMapper(loc)#

Maps the legend location to the matplotlib equivalent.

Parameters:

loc (str) – Location string (“right”, “left”, “above”, “below”).

Returns:

Matplotlib location string.

Return type:

str

classmethod from_dict(legend_dict: Dict[str, Any]) LegendConfig#

Convert a dictionary to a LegendConfig instance.

Parameters:

legend_dict (Dict[str, Any]) – Dictionary containing legend configuration.

Returns:

An instance of LegendConfig with the specified settings.

Return type:

LegendConfig