lets_plot.guide_legend

lets_plot.guide_legend(nrow=None, ncol=None, byrow=None)

Legend guide.

Parameters
  • nrow (int) – Number of rows in legend’s guide.

  • ncol (int) – Number of columns in legend’s guide.

  • byrow (bool, default=True) – Type of output: by row, or by column.

Returns

Color guide specification.

Return type

FeatureSpec

Note

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))