lets_plot.aes

lets_plot.aes(x=None, y=None, **other)

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

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