2DegreesInvesting / tiltPlot

Plots for the TILT project
https://2degreesinvesting.github.io/tiltPlot/
GNU General Public License v3.0
0 stars 0 forks source link

Adapt theme of tiltPlot to reflect the tilt theme #130

Closed lindadelacombaz closed 1 month ago

lindadelacombaz commented 1 month ago

Closes #60. Dear @maurolepore, Here is the PR that adapts the theme to reflect the tilt theme. I have followed the "Final templates, new tilt design and first reactions to our launch" mail and discussed with Anne. To load the font whenever the package is loaded, I have created a function .onLoad() in R/zzz.R.

Thanks !


TODO

EXCEPTIONS

lindadelacombaz commented 1 month ago

@maurolepore:

I have created a little Reprex so we remember how to add "Roboto" font to the tiltPlot package:

library(extrafont)
#> Registering fonts with R

#In separate R file in the tiltPlot package
load_custom_font <- function() {
  font_add_google("Roboto", "Roboto")
  showtext_auto()
}

#In R/zzz.R file
.onLoad <- function(libname, pkgname) {
  load_custom_font()
}

Created on 2024-05-28 with reprex v2.1.0.9000 This is supported by several researches:

  1. This blog, this stackoverflow question, and this question
  2. With regard to why not just call the library(extrafont), and where to put an .onLoad() function I have read the reference in the 6.5.4 When you do need side-effects section of “R Packages” by Hadley Wickham and Jennifer Bryan.
maurolepore commented 1 month ago

Thanks Linda! That shows how much time you had to spend researching how to implement this special font.

It's important to show that cost so it can be used to weight the priority.

Well done!