knitr::opts_chunk$set( collapse = TRUE, warning = FALSE, message = FALSE, eval = FALSE, fig.width = 10, fig.path = "inst/img/", comment = "#> ") hook_output <- knitr::knit_hooks$get("output") knitr::knit_hooks$set(output = function(x, options) { lines <- options$output.lines if (is.null(lines)) { return(hook_output(x, options)) # pass to default hook } x <- unlist(strsplit(x, "\n")) more <- "..." if (length(lines)==1) { # first n lines if (length(x) > lines) { # truncate the output, but add .... x <- c(head(x, lines), more) } } else { x <- c(if (abs(lines[1])>1) more else NULL, x[lines], if (length(x)>lines[abs(length(lines))]) more else NULL ) } # paste these lines together x <- paste(c(x, ""), collapse = "\n") hook_output(x, options) }) knitr::opts_chunk$set( comment = "#>", echo = TRUE, collapse = TRUE, eval = FALSE, warning = FALSE, message = FALSE )
ochathemes
is package providing ggplot2
themes and theme components inspired by OCHA graphics stylebook.
This package is not on yet on CRAN and to install it, you will need the remotes
package.
## install.packages("remotes") remotes::install_gitlab("dickoa/ochathemes")
humicons
packagelibrary(ochathemes) library(humicons) library(ggplot2) ggplot(mtcars, aes(mpg, wt)) + geom_text(family = font_hum, label = humicons("un-vehicle"), size = 7, color = "#418FDE") + labs(title = "Using the UN-Vehicle icon in ggplot2", x = "", y = "") + theme_ocha(grid = "XY")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.