Using letters as shapesΒΆ
[1]:
import pandas as pd
from plotnine import (
ggplot,
aes,
geom_point,
scale_shape_manual,
)
from plotnine.data import mtcars
You can create shape symbols using \(\TeX\). For example
[2]:
mixed_shapes = (
r'$\mathrm{A}$',
r'$\mathrm{B}$',
r'$\mathrm{C}$',
r'$\mathrm{D}$',
)
(ggplot(mtcars, aes('wt', 'mpg', shape='factor(gear)', colour='factor(gear)'))
+ geom_point(size=6)
+ scale_shape_manual(values=mixed_shapes)
)

[2]:
<Figure Size: (640 x 480)>
See matplotlib documentation for more.