Add a bold female symbol to ggplot2 using annotate

前端 未结 1 1449
北荒
北荒 2021-01-18 10:27

I\'m trying to use the female symbol, ♀ in my plot. It\'s pretty faint (well, it looks faint on my actual graph), so I was hoping to make it bold face.

df &         


        
相关标签:
1条回答
  • 2021-01-18 10:39

    @Axeman's comment helped me find an answer - I didn't realize you could load in other packages to get more fonts for ggplot2. Thanks! I used the following code:

    install.packages("extrafont")
    library(extrafont)
    font_import() # Prepare for this to take several minutes
    loadfonts(device = "win")
    
    ggplot(df, aes(x, y)) + geom_point() +
       theme_bw() +
       annotate("text", x = 0.5, y = 0.7, label = "2016 ♀", 
       size = 7, hjust = 0, colour = "grey50", family = "Calibri", fontface = "bold")
    

    0 讨论(0)
提交回复
热议问题