publiplots.create_legend_handles¶
- publiplots.create_legend_handles(labels, colors=None, hatches=None, sizes=None, markers=None, linestyles=None, alpha=None, linewidth=None, markeredgewidth=None, style='rectangle', color=None)[source]¶
Create custom legend handles with alpha and linewidth embedded.
- Parameters:
labels (List[str]) – Labels for each legend entry.
colors (List[str], optional) – Colors for each legend entry.
hatches (List[str], optional) – Hatch patterns for each legend entry (for rectangles).
sizes (List[float], optional) – Sizes for each legend entry (markersizes).
markers (List[str], optional) – Marker symbols for each legend entry (e.g., [‘o’, ‘^’, ‘s’]). If provided with linestyles, creates LineMarkerPatch handles. If provided without linestyles, creates MarkerPatch handles.
linestyles (List[str], optional) – Line styles for each legend entry (e.g., [‘-’, ‘–’, ‘:’]). If provided with markers, creates LineMarkerPatch handles.
alpha (float, default=DEFAULT_ALPHA) – Transparency level for fill layers.
linewidth (float, default=DEFAULT_LINEWIDTH) – Width of edge lines.
markeredgewidth (float, default=DEFAULT_MARKEREDEDGWIDTH) – Width of marker edges.
style (str, default="rectangle") – Style of legend markers: “rectangle”, “circle”, “marker”, or “line”. Ignored if markers parameter is provided.
color (str, optional) – Single color for all entries if colors not provided.
- Returns:
List of Patch objects with embedded properties.
- Return type:
List[Patch]