lets_plot.guides#

lets_plot.guides(**kwargs)#

Set guides for each scale.

Parameters:
kwargs

Key-value pairs where the key can be:

  • An aesthetic name

  • ‘manual’ - a key referring to the default custom legend

  • A group name referring to a custom legend where the group is defined via the layer_key() function

The value can be either:

  • A string (‘colorbar’, ‘legend’)

  • A call to a guide function (guide_colorbar(), guide_legend()) specifying additional arguments

  • ‘none’ to hide the guide

Returns:
FeatureSpec

Guides specification.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4n = 25
 5np.random.seed(42)
 6x = np.random.uniform(size=n)
 7y = np.random.uniform(size=n)
 8c = np.random.choice(list('abcdefgh'), size=n)
 9v = np.random.normal(size=n)
10ggplot({'x': x, 'y': y, 'c': c, 'v': v}, aes('x', 'y')) + \
11    geom_point(aes(shape='c', color='v'), size=4) + \
12    scale_color_gradient2(low='red', mid='yellow', high='blue') + \
13    guides(shape=guide_legend(ncol=2), \
14           color=guide_colorbar(nbin=8, barwidth=20))

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4n = 10
 5np.random.seed(42)
 6x = list(range(n))
 7y = np.random.uniform(size=n)
 8ggplot({'x': x, 'y': y}, aes('x', 'y')) + \
 9    geom_point(color='red', manual_key="point") + \
10    geom_line(color='blue', manual_key="line") + \
11    guides(manual=guide_legend('Zones', ncol=2))