guide_legend#

guide_legend(title=None, *, nrow=None, ncol=None, byrow=None, override_aes=None)#

Legend guide.

Parameters:
titlestr

Title of guide.

nrowint

Number of rows in legend’s guide.

ncolint

Number of columns in legend’s guide.

byrowbool, default=True

Type of output: by row, or by column.

override_aesdict

Dictionary that maps aesthetic parameters to new values, overriding the default legend appearance. Each value can be a constant applied to all keys or a list that changes particular keys.

Returns:
FeatureSpec

Legend guide specification.

Notes

Legend type guide shows key (i.e., geoms) mapped onto values.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4n = 100
 5np.random.seed(42)
 6x = np.random.uniform(size=n)
 7y = np.random.uniform(size=n)
 8c = np.random.choice(list('abcdefgh'), size=n)
 9ggplot({'x': x, 'y': y, 'c': c}, aes('x', 'y')) + \
10    geom_point(aes(shape='c'), size=4, alpha=.7) + \
11    scale_shape(guide=guide_legend(nrow=3, override_aes={'color': 'red'}))