Skip to content
Snippets Groups Projects
Commit 542597fc authored by Jorge Saturno's avatar Jorge Saturno
Browse files

Change fonts to IBM Plex Sans using {gdtools}

parent 44b13b4a
No related branches found
No related tags found
No related merge requests found
...@@ -13,12 +13,18 @@ library(reshape2) ...@@ -13,12 +13,18 @@ library(reshape2)
library(scales) library(scales)
library(tidyverse) library(tidyverse)
library(DT) library(DT)
library(gdtools)
# library(systemfonts)
# library(hrbrthemes) # library(hrbrthemes)
register_gfont("IBM Plex Sans")
# Define UI for application # Define UI for application
ui <- page_sidebar( ui <- page_sidebar(
title = "⚫ Atmospheric black carbon MAC review", title = "⚫ Atmospheric black carbon MAC review",
theme = bs_theme(bootswatch = "minty"), theme = bs_theme(bootswatch = "minty"),
addGFontHtmlDependency(family = c("IBM Plex Sans")),
# tags$head(tags$style(type="text/css", "text {font-family: sans-serif}")),
sidebar = sidebar( sidebar = sidebar(
h4("Chart settings"), h4("Chart settings"),
...@@ -49,6 +55,8 @@ ui <- page_sidebar( ...@@ -49,6 +55,8 @@ ui <- page_sidebar(
# Define server logic required to output plots and tables # Define server logic required to output plots and tables
server <- function(input, output) { server <- function(input, output) {
register_gfont("IBM Plex Sans")
# Data processing # Data processing
MAC_data <- read_delim("data/MAC_table.csv", ",", skip = 1, MAC_data <- read_delim("data/MAC_table.csv", ",", skip = 1,
col_names = c("MAC_m2g", "MAC_sd", "MAC_method", "Wavelength_nm", col_names = c("MAC_m2g", "MAC_sd", "MAC_method", "Wavelength_nm",
...@@ -132,7 +140,7 @@ server <- function(input, output) { ...@@ -132,7 +140,7 @@ server <- function(input, output) {
MAC_MAC550.gg <- MAC_MAC550 + MAC_MAC550.gg <- MAC_MAC550 +
# theme_ipsum(base_family = "IBM Plex Sans") + # theme_ipsum(base_family = "IBM Plex Sans") +
theme_minimal() + theme_minimal(base_family = "IBM Plex Sans") +
theme(axis.text.y = element_text(size = 10), theme(axis.text.y = element_text(size = 10),
axis.text.x = element_text(size = 12), axis.text.x = element_text(size = 12),
axis.title.x = element_text(size=16), axis.title.x = element_text(size=16),
...@@ -188,6 +196,7 @@ server <- function(input, output) { ...@@ -188,6 +196,7 @@ server <- function(input, output) {
facet_grid(Study_durn ~ ., scales = "free", space = "free") facet_grid(Study_durn ~ ., scales = "free", space = "free")
girafe(ggobj = MAC_MAC550.gg, width_svg = 14, height_svg = 10, girafe(ggobj = MAC_MAC550.gg, width_svg = 14, height_svg = 10,
# fonts = list(sans = "Arial"),
options = list( options = list(
opts_hover(css = "fill:grey80;"), opts_hover(css = "fill:grey80;"),
opts_hover_inv(css = "opacity:0.1;"), opts_hover_inv(css = "opacity:0.1;"),
...@@ -205,7 +214,7 @@ server <- function(input, output) { ...@@ -205,7 +214,7 @@ server <- function(input, output) {
MAC_lambda.gg <- MAC_lambda + MAC_lambda.gg <- MAC_lambda +
# theme_ipsum(base_family = "IBM Plex Sans") + # theme_ipsum(base_family = "IBM Plex Sans") +
theme_minimal() + theme_minimal(base_family = "IBM Plex Sans") +
theme(axis.text.y = element_text(size = 10), theme(axis.text.y = element_text(size = 10),
axis.text.x = element_text(size = 12), axis.text.x = element_text(size = 12),
axis.title.x = element_text(size=16), axis.title.x = element_text(size=16),
...@@ -243,11 +252,12 @@ server <- function(input, output) { ...@@ -243,11 +252,12 @@ server <- function(input, output) {
family = "Arial", size = 7, label = "\u2726", family = "Arial", size = 7, label = "\u2726",
alpha = 0.7, show.legend = TRUE, alpha = 0.7, show.legend = TRUE,
position = position_nudge(x = 0.1)) + # Fill character in front position = position_nudge(x = 0.1)) + # Fill character in front
annotate("text", x=335, y=14.8, label= expression(paste(italic(E)[abs], " = 1; AAE = 1"))) + annotate("text", x=335, y=14.8, family = "IBM Plex Sans", label= expression(paste(italic(E)[abs], " = 1; AAE = 1"))) +
annotate("text", x=335, y=29, label= expression(paste(italic(E)[abs], " = 2; AAE = 1"))) annotate("text", x=335, y=29, family = "IBM Plex Sans", label= expression(paste(italic(E)[abs], " = 2; AAE = 1")))
girafe(ggobj = MAC_lambda.gg, width_svg = 14, height_svg = 10, girafe(ggobj = MAC_lambda.gg, width_svg = 14, height_svg = 10,
# fonts = list(sans = "Arial"),
options = list( options = list(
opts_hover(css = "fill:grey80;"), opts_hover(css = "fill:grey80;"),
opts_hover_inv(css = "opacity:0.1;"), opts_hover_inv(css = "opacity:0.1;"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment