labs#
- labs(title=None, subtitle=None, caption=None, **labels)#
Change plot title, axis labels and legend titles.
- Parameters:
- titlestr
The text for the plot title.
- subtitlestr
The text for the plot subtitle.
- captionstr
The text for the plot caption.
- labels
Name-value pairs where the name 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 should be a string, e.g. color=”New Color label”.
- Returns:
- FeatureSpec or FeatureSpecArray
Labels specification.
Examples
1from lets_plot import * 2LetsPlot.setup_html() 3data = {'x': list(range(10)), 'y': list(range(10))} 4ggplot(data, aes('x', 'y')) + geom_point(aes(size='y')) + \ 5 labs(title='New plot title', subtitle='The plot subtitle', caption='The plot caption', \ 6 x='New x axis label', y='New y axis label', size='New legend title')
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 labs(manual='Zones')