Skip to content

geom_text: family aesthetic does not seem to use mappings #790

@machow

Description

@machow

Manually specifying sans-serif or serif seems to work. But using those in a mapping to family doesn't seem to work (at least on my Mac). (I also noticed that there doesn't seem to be support for "mono", but that might be worth a separate issue?)

from plotnine import *
import pandas as pd

df = pd.DataFrame({"x": 1, "y": [2, 1], "family": ["sans-serif", "serif"]})

# doesn't seem to be used, everything is sans-serif
(
  ggplot(df, aes("x", "y")) + 
  geom_text(aes(label = "family", family="family"), size=20)
)
image
# works (all sans-serif)
(
  ggplot(df, aes("x", "y")) + 
  geom_text(aes(label = "family"), family = "sans-serif", size=20)
)
image
# also works (all serif)
(
  ggplot(df, aes("x", "y")) + 
  geom_text(aes(label = "family"), family = "serif", size=20)
)
image

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions