import pandas as pd
import numpy as np
from plotnine import ggplot, aes, geom_point
aes
Mapping variables to the visual properties of a plot.
= pd.DataFrame({
df "col1": np.arange(11),
"col2": np.arange(11)
})
(="col1", y="col2"))
ggplot(df, aes(x+ geom_point()
)
(="col1", y="col2 ** 2"))
ggplot(df, aes(x+ geom_point()
)
(="col1", y="np.square(col2)"))
ggplot(df, aes(x+ geom_point()
)
The first two positional arguments are x
and y
aesthetics. Any other aesthetic must be mapped with a keyword argument.
("col1", "np.square(col2)", color="col2"))
ggplot(df, aes(+ geom_point(size=3)
)