aes#
- aes(x=None, y=None, **kwargs)#
Define aesthetic mappings.
- Parameters:
- x, y, …
List of name value pairs giving aesthetics to map to variables. The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named.
- Returns:
- FeatureSpec
Aesthetic mapping specification.
Notes
Generate aesthetic mappings that describe how variables in the data are projected to visual properties (aesthetics) of geometries. This function also standardizes aesthetic names by, for example, converting colour to color.
Aesthetic mappings are not to be confused with aesthetic settings; the latter are used to set aesthetics to some constant values, e.g. make all points red in the plot. If one wants to make the color of a point depend on the value of a variable, he/she should project this variable to the color aesthetic via aesthetic mapping.
Examples
1import numpy as np 2from lets_plot import * 3LetsPlot.setup_html() 4n = 100 5np.random.seed(42) 6x = np.random.uniform(-1, 1, size=n) 7y = 25 * x ** 2 + np.random.normal(size=n) 8c = np.where(x < 0, '0', '1') 9ggplot({'x': x, 'y': y, 'c': c}) + \ 10 geom_point(aes('x', 'y', color='y', shape='c', size='x')) + \ 11 geom_smooth(aes(x='x', y='y'), deg=2, size=1)
1from lets_plot import * 2LetsPlot.setup_html() 3ggplot() + geom_polygon(aes(x=[0, 1, 2], y=[2, 1, 4]), \ 4 color='black', alpha=.5, size=1)