Hi, thank you very much for this great package! I used it for several occasions but this time I wanted not only to include font awesome icons but also customized fonts.
ggsave("nobel_font_okay.pdf", width = 9, height = 5, device = cairo_pdf)
ggsave("nobel_font_okay.png", width = 9, height = 5)
saved png: https://i.imgur.com/f6j3nVG.png
## same plot but emojifont loaded
library(emojifont)
#> Warning: Paket 'emojifont' wurde unter R Version 3.5.3 erstellt
ggplot(df_nobel_proc, aes(prize_year, n, color = gender)) +
geom_line(alpha = 0.5) +
geom_point() +
theme_light(base_family = "Poppins") +
theme(axis.text = element_text(family = "Roboto Mono"),
legend.direction = "horizontal",
legend.position = "bottom") +
labs(x = NULL, y = NULL, title = "Nobel Prize Winners by Gender")
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
ggsave("nobel_font_not_found.pdf", width = 9, height = 5, device = cairo_pdf)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
ggsave("nobel_font_not_found.png", width = 9, height = 5)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> ...and so on and on... (shortened redundant output to allow for some readability)
saved png: https://imgur.com/9YlFLOq.png
sessionInfo
#> function (package = NULL)
#> {
#> z <- list()
#> z$R.version <- R.Version()
#> z$platform <- z$R.version$platform
#> if (nzchar(.Platform$r_arch))
#> z$platform <- paste(z$platform, .Platform$r_arch, sep = "/")
#> z$platform <- paste0(z$platform, " (", 8 * .Machine$sizeof.pointer,
#> "-bit)")
#> z$locale <- Sys.getlocale()
#> if (.Platform$OS.type == "windows") {
#> z$running <- win.version()
#> }
#> else if (nzchar(Sys.which("uname"))) {
#> uname <- system("uname -a", intern = TRUE)
#> os <- sub(" .*", "", uname)
#> z$running <- switch(os, Linux = if (file.exists("/etc/os-release")) {
#> tmp <- readLines("/etc/os-release")
#> t2 <- if (any(startsWith(tmp, "PRETTY_NAME="))) sub("^PRETTY_NAME=",
#> "", grep("^PRETTY_NAME=", tmp, value = TRUE)[1L]) else if (any(startsWith(tmp,
#> "NAME"))) sub("^NAME=", "", grep("^NAME=", tmp,
#> value = TRUE)[1L]) else "Linux (unknown distro)"
#> sub("\"(.*)\"", "\\1", t2)
#> } else if (file.exists("/etc/system-release")) {
#> readLines("/etc/system-release")
#> }, Darwin = {
#> ver <- readLines("/System/Library/CoreServices/SystemVersion.plist")
#> ind <- grep("ProductUserVisibleVersion", ver)
#> ver <- ver[ind + 1L]
#> ver <- sub(".*<string>", "", ver)
#> ver <- sub("</string>$", "", ver)
#> ver1 <- strsplit(ver, ".", fixed = TRUE)[[1L]][2L]
#> sprintf("%s %s %s", ifelse(as.numeric(ver1) < 12,
#> "OS X", "macOS"), switch(ver1, `6` = "Snow Leopard",
#> `7` = "Lion", `8` = "Mountain Lion", `9` = "Mavericks",
#> `10` = "Yosemite", `11` = "El Capitan", `12` = "Sierra",
#> `13` = "High Sierra", ""), ver)
#> }, SunOS = {
#> ver <- system("uname -r", intern = TRUE)
#> paste("Solaris", strsplit(ver, ".", fixed = TRUE)[[1L]][2L])
#> }, uname)
#> }
#> if (is.null(package)) {
#> package <- grep("^package:", search(), value = TRUE)
#> keep <- vapply(package, function(x) x == "package:base" ||
#> !is.null(attr(as.environment(x), "path")), NA)
#> package <- .rmpkg(package[keep])
#> }
#> pkgDesc <- lapply(package, packageDescription, encoding = NA)
#> if (length(package) == 0)
#> stop("no valid packages were specified")
#> basePkgs <- sapply(pkgDesc, function(x) !is.null(x$Priority) &&
#> x$Priority == "base")
#> z$basePkgs <- package[basePkgs]
#> if (any(!basePkgs)) {
#> z$otherPkgs <- pkgDesc[!basePkgs]
#> names(z$otherPkgs) <- package[!basePkgs]
#> }
#> loadedOnly <- loadedNamespaces()
#> loadedOnly <- loadedOnly[!(loadedOnly %in% package)]
#> if (length(loadedOnly)) {
#> names(loadedOnly) <- loadedOnly
#> pkgDesc <- c(pkgDesc, lapply(loadedOnly, packageDescription))
#> z$loadedOnly <- pkgDesc[loadedOnly]
#> }
#> z$matprod <- as.character(options("matprod"))
#> es <- extSoftVersion()
#> z$BLAS <- as.character(es["BLAS"])
#> z$LAPACK <- La_library()
#> class(z) <- "sessionInfo"
#> z
#> }
#> <bytecode: 0x0000000011fa6b38>
#> <environment: namespace:utils>