Changing fonts in ggplot2

前端 未结 5 1407
盖世英雄少女心
盖世英雄少女心 2020-11-22 12:59

Once upon a time, I changed my ggplot2 font using using windowsFonts(Times=windowsFont(\"TT Times New Roman\")) to change it. Now I can\'t get it

5条回答
  •  礼貌的吻别
    2020-11-22 13:32

    Late to the party, but this might be of interest for people looking to add custom fonts to their ggplots inside a shiny app on shinyapps.io.

    You can:

    1. Place custom font in www directory: e.g. IndieFlower.ttf from here
    2. Follow the steps from here

    This leads to the following upper section inside the app.R file:

    dir.create('~/.fonts')
    file.copy("www/IndieFlower.ttf", "~/.fonts")
    system('fc-cache -f ~/.fonts')
    

    A full example app can be found here.

提交回复
热议问题