lets_plot.layer_tooltips

class lets_plot.layer_tooltips(variables: Optional[List[str]] = None)

Configure tooltips.

Notes

Set tooltips=’none’ to hide tooltips from this layer.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4n = 100
 5np.random.seed(42)
 6data = {
 7    'id': np.arange(n),
 8    'x': np.random.normal(size=n),
 9    'y': np.random.normal(size=n),
10    'c': np.random.choice(['a', 'b'], size=n),
11    'w': np.random.randint(1, 11, size=n)
12}
13ggplot(data, aes('x', 'y')) + \
14    geom_point(aes(color='c', size='w'), \
15               tooltips=layer_tooltips().line('@c "@id"')
16                                        .line('---')
17                                        .format('@y', '.2f')
18                                        .line('(x, y)|(^x, @y)')
19                                        .line('@|@w')) + \
20    scale_size(range=[2, 4])