hrbrthemes
Python
https://github.com/hrbrmstr/hrbrthemes-p9
$ python3 -m pip install hrbrthemes
from hrbrthemes import theme_ipsum from plotnine.data import mtcars p= ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) +\ geom_point() +\ labs(title = "hrbrmstr's Fav Example Plot", x = "Weight (tons)", y = "Miles-per-gallon") +\ theme_ipsum() print(p)
R
https://cran.r-project.org/web/packages/hrbrthemes/
theme_set(theme_ipsum())
> install.packages('hrbrthemes') also installing the dependencies ‘extrafontdb’, ‘Rttf2pt1’, ‘systemfonts’, ‘extrafont’, ‘gdtools’ ... > library('hrbrthemes') NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes. Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and if Arial Narrow is not on your system, please see http://bit.ly/arialnarrow > import_roboto_condensed() You will likely need to install these fonts on your system as well. You can find them in [/Library/Frameworks/R.framework/Versions/3.5/Resources/library/hrbrthemes/fonts/roboto-condensed]
Font설치
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database
https://stackoverflow.com/questions/34522732/changing-fonts-in-ggplot2
font에 대한 초기화 과정이 필요하다.
일단 어떤 font를 현재 사용할수 있는지 확인해본다.
> windowsFonts() $serif [1] "TT Times New Roman" $sans [1] "TT Arial" $mono [1] "TT Courier New" $`Roboto Condensed` [1] "Roboto Condensed"
extraFont 팩키지의 font_import
를 통해 현재 가지고 있는 font를 import한다.
(엄청오래걸림 주의~)
library(extrafont) font_import() #Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system. #Continue? [y/n] y #Scanning ttf files in C:\\Windows\\Fonts ... #Extracting .afm files from .ttf files... #C:\\Windows\\Fonts\\AGENCYB.TTF => C:/Program Files/R/R-3.6.1/library/extrafontdb/metrics/AGENCYB #C:\\Windows\\Fonts\\AGENCYR.TTF => C:/Program Files/R/R-3.6.1/library/extrafontdb/metrics/AGENCYR ......
loadfonts(device = "win")