Download notebook (.ipynb)

Text#

from lets_plot import *

from common import docs_dark_theme
LetsPlot.setup_html()

Font Family#

def get_font_family_plot():
    families = ['sans', 'serif', 'mono']
    data = dict(
        y = list(range(len(families))),
        f = families
    )
    return ggplot(data) + \
        geom_label(aes(y='y', label='f', family='f'), \
                   x=0, size=1, size_unit='y') + \
        scale_y_reverse(limits=[-.5, len(families) - .5]) + \
        ggsize(200, 400) + \
        theme_void()
family_plot = get_font_family_plot()
ggsave(family_plot, "aesthetics_font_family.png")
family_plot
family_plot_dark = get_font_family_plot() + docs_dark_theme()
ggsave(family_plot_dark, "aesthetics_font_family_dark.png")
family_plot_dark

Font Face#

def get_font_face_plot():
    faces = ['plain', 'bold', 'italic', 'bold italic']
    data = dict(
        y = list(range(len(faces))),
        f = faces
    )
    return ggplot(data) + \
        geom_label(aes(y='y', label='f', fontface='f'), \
                   x=0, size=1, size_unit='y') + \
        scale_y_reverse(limits=[-.5, len(faces) - .5]) + \
        ggsize(300, 400) + \
        theme_void()
face_plot = get_font_face_plot()
ggsave(face_plot, "aesthetics_font_face.png")
face_plot
face_plot_dark = get_font_face_plot() + docs_dark_theme()
ggsave(face_plot_dark, "aesthetics_font_face_dark.png")
face_plot_dark