Using letters as shapesΒΆ

[1]:
import pandas as pd

from plotnine import *
from plotnine.data import mtcars

%matplotlib inline

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)
)
../_images/tutorials_miscellaneous-using-letter-as-shapes_3_0.png
[2]:
<ggplot: (97654321012345679)>

See matplotlib documentation for more.