Skip to content

GC.legend() ​

Set the legend.

Usage ​

python
chart.legend(
    group,
    show,
    background_color,
    order,
    position,
    align,
    style,
    legend_options,
    legend_text_options,
    corner_radius,
    group_style,
    **options,
)

An argument shown without a default is optional too: left out, the chart keeps its default.

chart is a GC chart.

Arguments ​

ArgumentTypeDescription
groupstr or bool, optionalColumn of the groups in the legend. Default: the group of the chart. False hides the legend.
showboolWhether to show the legend. Default True.
background_colorstr, optionalBackground colour of the legend; style={"backgroundColor": ...} takes precedence. Default: the theme's, else transparent.
orderlistThe order of the groups in the legend.
positionstr, optional"top" or "bottom". Default: the theme's, else "bottom".
alignstr, optional"left", "center" or "right". Default: the theme's, else "left".
styledictCSS styles of the legend.
legend_optionsdictOptions of the markers (markerStyle in the spec).
legend_text_optionsdictOptions of the text (textStyle in the spec).
corner_radiusfloat, optionalRadius in pixels of the rounded corners of the markers.
group_styledict of dict, optionalStyles of the entry of a group, e.g. {"tnsA": {"fontStyle": "italic"}}; styles in marker go to its marker.
**optionsFurther options, e.g. orientation="vertical".

Value ​

GC: The chart.