aes

import pandas as pd
import numpy as np

from plotnine import ggplot, aes, geom_point

Mapping variables to the visual properties of a plot.

df = pd.DataFrame({
    "col1": np.arange(11),
    "col2": np.arange(11)
})

(
    ggplot(df, aes(x="col1", y="col2"))
    + geom_point()
)

(
    ggplot(df, aes(x="col1", y="col2 ** 2"))
    + geom_point()
)

(
    ggplot(df, aes(x="col1", y="np.square(col2)"))
    + geom_point()
)

The first two positional arguments are x and y aesthetics. Any other aesthetic must be mapped with a keyword argument.

(
    ggplot(df, aes("col1", "np.square(col2)", color="col2"))
    + geom_point(size=3)
)