Text

In [1]:
from lets_plot import *

from common import docs_dark_theme
In [2]:
LetsPlot.setup_html()

Font Family

In [3]:
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()
In [4]:
family_plot = get_font_family_plot()
ggsave(family_plot, "aesthetics_font_family.png")
family_plot
Out[4]:
In [5]:
family_plot_dark = get_font_family_plot() + docs_dark_theme()
ggsave(family_plot_dark, "aesthetics_font_family_dark.png")
family_plot_dark
Out[5]:

Font Face

In [6]:
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()
In [7]:
face_plot = get_font_face_plot()
ggsave(face_plot, "aesthetics_font_face.png")
face_plot
Out[7]:
In [8]:
face_plot_dark = get_font_face_plot() + docs_dark_theme()
ggsave(face_plot_dark, "aesthetics_font_face_dark.png")
face_plot_dark
Out[8]: