diff --git a/.Rbuildignore b/.Rbuildignore index 31494e8..f529ba5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,4 @@ ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^data-raw$ diff --git a/.gitignore b/.gitignore index ae73e6d..ecb1ef1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .Rdata .httr-oauth .DS_Store +R/test.R diff --git a/DESCRIPTION b/DESCRIPTION index cb9e84b..2fed535 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,23 +1,39 @@ -Package: visualizeR -Type: Package -Title: What a color! What a viz! -Version: 0.1.0 -Authors@R: c( - person( - 'Noblet', 'Guillaume', - email = 'gnoblet@zaclys.net', - role = c('aut', 'cre') - ) - ) -URL: https://github.com/gnoblet/visualizeR, - https://gnoblet.github.io/visualizeR/ -Maintainer: Guillaume Noblet -Description: It basically provides colors as hex codes, color palettes, and some viz functions (graphs and maps). -Depends: R (>= 4.1.0) -License: GPL (>= 3) -Encoding: UTF-8 -LazyData: true -RoxygenNote: 7.1.2 -Imports: ggplot2, rlang, grDevices, simplevis -Suggests: knitr -VignetteBuilder: knitr +Package: visualizeR +Type: Package +Title: What a color! What a viz! +Version: 0.8.9000 +Authors@R: c( + person( + 'Noblet', 'Guillaume', + email = 'gnoblet@zaclys.net', + role = c('aut', 'cre') + ) + ) +URL: https://github.com/gnoblet/visualizeR, + https://gnoblet.github.io/visualizeR/ +Maintainer: Guillaume Noblet +Description: It basically provides colors as hex codes, color palettes, and some viz functions (graphs and maps). +Depends: R (>= 4.1.0) +License: GPL (>= 3) +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.2.3 +Imports: + ggplot2, + rlang (>= 0.4.11), + grDevices, + glue, + scales, + ggtext, + ggrepel, + tidyr, + dplyr, + ggalluvial, + viridisLite, + waffle +Suggests: + knitr, + roxygen2, + sf, + tmap +VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 40ea8e2..6b1f9a3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1 +1 @@ -exportPattern("^[[:alpha:]]+") +exportPattern("^[^\\.]") diff --git a/NEWS.md b/NEWS.md index c11824a..61ad5bf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,108 @@ -# visualizeR 0.1.0 - -* Added a `NEWS.md` file to track changes to the package. -* Initiate repo +# visualizeR 0.8.9000 + +* Add `waffle()`. +* Add a `pal_default()` function as a fallback for scale functions and as an initiative in `theme_reach()`. It uses `viridis::magma()`. +* Update of AGORA palettes. +* Some other small bug fixes. + +--- + +# visualizeR 0.7.9000 + +* Add `dumbbell()`. +* Add `alluvial()` +* Add `donut()` +* Add `lollipop()` +* Add further parameters to `theme_reach()`, including grid lines args. + +--- + +# visualizeR 0.6.9000 + +* Add `dumbbell()`. +* Add further parameters to `theme_reach()`. + +--- + +# visualizeR 0.5.9000 + +* Add wrapping of title, subtitle and caption thanks to `ggtext` +* Add wrapping of labels for `bar()` x-discrete scale. +* Add further parameters to `theme_reach()` + +--- + +# visualizeR 0.4.9000 + +* Breaking changes: remove dependency to `ggblanket`. +* Full rewrite of `theme_reach()`. +* `bar_reach` is now `bar()` and theming is passed through argument `theme` for which default is `theme_reach()`. +* `point_reach` is now `point()` and theming is passed through argument `theme` for which default is `theme_reach()`. + +--- + +# visualizeR 0.3.9000 + +* Breaking changes: update to `ggblanket` v1.6.1. +* Add plotting functions for indicator maps. + +--- + +# visualizeR 0.2.9000 + +* Breaking changes: almost all functions got refinements, and there are new functions, typically `hbar()` becomes `bar_reach()` and `point_reach()` is added. +* Following `theme_reach()` is now used by all plotting functions. +* Add README.md. + +--- + +# visualizeR 0.1.7.9000 + +* Fixed some color palettes. + +--- + +# visualizeR 0.1.6.9000 + +* IMPACT colors and palettes are added: function `cols_impact()` `pal_impact()`. +* Color palettes from REACH are added (2 to 7 continuous palettes) ; see updated `cols_reach()` and `pal_reach()`. + +--- + +# visualizeR 0.1.5.9000 + +* Move from `simplevis` to successor `ggblanket`. + +--- + +# visualizeR 0.1.4.9000 + +* `hbar()` gains a new boolean argument `reverse` to pass to `pal_reach()` or `pal_agora()`, indicating if the color palette should be reversed or not. + +--- + +# visualizeR 0.1.3.9000 + +* Small change to `hbar()`: removes error arg within `simplevis::gg_hbar()` call. + +--- + +# visualizeR 0.1.2.9000 + +* There was a duplicate `scale_color()` function, which should have been and is now `scale_fill()` + +--- + +# visualizeR 0.1.1.9000 + +* Added two horizontal bar functions: `hbar()`, `hbar_percent()` (#3) +* Added some internals to check for missing columns and bad arguments (#3) +* Modified some `theme_reach()` documentation +* Add `buffer_bbox()` function to produce a buffered bbox, e.g. for use with `tmap` + +--- + +# visualizeR 0.1.0 + +* Added a `NEWS.md` file to track changes to the package +* Initiate repo diff --git a/R/alluvial.R b/R/alluvial.R new file mode 100644 index 0000000..5665585 --- /dev/null +++ b/R/alluvial.R @@ -0,0 +1,104 @@ +#' @title Simple alluvial chart +#' +#' @param df A data frame. +#' @param from A character column of upstream stratum. +#' @param to A character column of downstream stratum. +#' @param value A numeric column of values. +#' @param group The grouping column to fill the alluvium with. +#' @param alpha Fill transparency. Default to 0.5. +#' @param from_levels Order by given from levels? +#' @param value_title The value/y scale title. Default to NULL. +#' @param group_title The group title. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param rect_color Stratum rectangles' fill color. +#' @param rect_border_color Stratum rectangles' border color. +#' @param rect_text_color Stratum rectangles' text color. +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A donut chart to be used parsimoniously +#' +#' @export +alluvial <- function( + df, + from, + to, + value, + group = NULL, + alpha = 0.5, + from_levels = NULL, + value_title = NULL, + group_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + rect_color = cols_reach("white"), + rect_border_color = cols_reach("main_grey"), + rect_text_color = cols_reach("main_grey"), + theme = theme_reach(axis_y = FALSE, + legend_position = "none") +){ + + if(!is.null(from_levels)) df <- dplyr::mutate(df, "{{from}}" := factor({{ from }}, levels = from_levels)) + + # General mapping + g <- ggplot2::ggplot( + data = df, + mapping = ggplot2::aes( + y = {{ value }}, + axis1 = {{ from }}, + axis3 = {{ to }} + ) + ) + + # Add alluvium + g <- g + + ggalluvial::geom_alluvium( + ggplot2::aes( + fill = {{ group }}, + color = {{ group }} + ), + alpha = alpha) + + # Add stratum + g <- g + + ggalluvial::geom_stratum( + fill = rect_color, + color = rect_border_color + ) + + # Add stratum text + + stratum <- ggalluvial::StatStratum + + g <- g + + ggplot2::geom_text( + stat = stratum, + ggplot2::aes(label = ggplot2::after_stat(!!rlang::sym("stratum"))), + color = cols_reach("main_grey") + ) + + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + y = value_title, + title = title, + subtitle = subtitle, + caption = caption, + fill = group_title, + color = group_title + ) + + # Remove x-axis + g <- g + ggplot2::theme( + axis.line.x = ggplot2::element_blank(), + axis.ticks.x = ggplot2::element_blank(), + axis.text.x = ggplot2::element_blank(), + axis.title.x = ggplot2::element_blank() + ) + + g <- g + theme + + return(g) +} diff --git a/R/bar.R b/R/bar.R new file mode 100644 index 0000000..895eb92 --- /dev/null +++ b/R/bar.R @@ -0,0 +1,141 @@ +#' @title Simple bar chart +#' +#' @param df A data frame. +#' @param x A numeric column. +#' @param y A character column or coercible as a character column. +#' @param group Some grouping categorical column, e.g. administrative areas or population groups. +#' @param flip TRUE or FALSE. Default to TRUE or horizontal bar plot. +#' @param percent TRUE or FALSE. Should the x-labels (and text labels if present) be displayed as percentages? Default to TRUE. +#' @param wrap Should x-labels be wrapped? Number of characters. +#' @param position Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack". +#' @param alpha Fill transparency. +#' @param x_title The x scale title. Default to NULL. +#' @param y_title The y scale title. Default to NULL. +#' @param group_title The group legend title. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param add_text TRUE or FALSE. Add the value as text. +#' @param add_text_suffix If percent is FALSE, should we add a suffix to the text label? +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A bar chart +#' +#' @export +bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, wrap = NULL, position = "dodge", alpha = 1, x_title = NULL, y_title = NULL, group_title = NULL, title = NULL, subtitle = NULL, caption = NULL, add_text = FALSE, add_text_suffix = "", theme = theme_reach()){ + + # To do : + # - automate bar width and text size, or at least give the flexibility and still center text + # - add facet possibility + + # Prepare group, x and y names + # if (is.null(x_title)) x_title <- rlang::as_name(rlang::enquo(x)) + # if (is.null(y_title)) y_title <- rlang::as_name(rlang::enquo(y)) + # if (is.null(group_title)) group_title <- rlang::as_name(rlang::enquo(group)) + + # Mapping + g <- ggplot2::ggplot( + df, + mapping = ggplot2::aes(x = {{ x }}, y = {{ y }}, fill = {{ group }}, color = {{ group }} + ) + ) + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + x = x_title, + y = y_title, + color = group_title, + fill = group_title + ) + + width <- 0.5 + dodge_width <- 0.5 + + # Should the graph use position_fill? + if (position == "stack"){ + g <- g + ggplot2::geom_col( + alpha = alpha, + width = width, + position = ggplot2::position_stack() + ) + } else if (position == "dodge"){ + g <- g + ggplot2::geom_col( + alpha = alpha, + width = width, + position = ggplot2::position_dodge2( + width = dodge_width, + preserve = "single") + ) + } else{ + g <- g + ggplot2::geom_col( + alpha = alpha, + width = width + ) + } + # + # Labels to percent and expand scale + if (percent) { + g <- g + ggplot2::scale_y_continuous( + labels = scales::label_percent( + accuracy = 1, + decimal.mark = ",", + suffix = " %"), + expand = c(0.01, 0.1) + ) + } else { + g <- g + ggplot2::scale_y_continuous(expand = c(0.01, 0.1)) + } + + if (!is.null(wrap)) { + g <- g + ggplot2::scale_x_discrete(labels = scales::label_wrap(wrap)) + } + + # Because a text legend should always be horizontal, especially for an horizontal bar graph + if (flip){ + g <- g + ggplot2::coord_flip() + } + + # Add text to bars + if (flip) hjust_flip <- 1.5 else hjust_flip <- 0.5 + if (flip) vjust_flip <- 0.5 else vjust_flip <- 1.5 + + if (add_text & position != "dodge") { + rlang::abort("Adding text labels and positions different than dodges as not been implemented yet") + } + + # Add text labels + if (add_text) { + if (percent) { + g <- g + ggplot2::geom_text( + ggplot2::aes( + label = scales::label_percent( + accuracy = 1, + decimal.mark = ",", + suffix = " %")({{ y }}), + group = {{ group }}), + hjust = hjust_flip, + vjust = vjust_flip, + color = "white", + fontface = "bold", + position = ggplot2::position_dodge(width = dodge_width)) + } else { + g <- g + ggplot2::geom_text( + ggplot2::aes( + label = paste0(round({{ y }}), add_text_suffix), + group = {{ group }}), + hjust = hjust_flip, + vjust = vjust_flip, + color = "white", + fontface = "bold", + position = ggplot2::position_dodge(width = dodge_width)) + } + } + + # Add theme + g <- g + theme + + return(g) +} diff --git a/R/bbox_buffer.R b/R/bbox_buffer.R new file mode 100644 index 0000000..be11e5a --- /dev/null +++ b/R/bbox_buffer.R @@ -0,0 +1,39 @@ +#' @title Bbbox buffer +#' +#' @param sf_obj A `sf` object +#' @param buffer A buffer, either one value or a vector of 4 values (left, bottom, right, top). Default to 0. +#' +#' @return A bbox with a buffer +#' +#' @export +buffer_bbox <- function(sf_obj, buffer = 0){ + + rlang::check_installed("sf", reason = "Package \"sf\" needed for `buffer_bbox()` to work. Please install it.") + + + if (!(length(buffer) %in% c(1,4)) | !is.numeric(buffer)) stop("Please provide a numeric buffer of length 1 or 4.") + + bbox <- sf::st_bbox(sf_obj) + xrange <- bbox$xmax - bbox$xmin # range of x values + yrange <- bbox$ymax - bbox$ymin # range of y values + + + bbox_with_buffer <- if (length(buffer) == 1) { + c( + bbox[1] - (buffer * xrange), # xmin - left + bbox[2] - (buffer * yrange), # ymin - bottom + bbox[3] + (buffer * xrange), # xmax - right + bbox[4] + (buffer * yrange) # ymax - top + ) + } else if (length(buffer) == 4) { + c( + bbox[1] - (buffer[1] * xrange), # xmin - left + bbox[2] - (buffer[2] * yrange), # ymin - bottom + bbox[3] + (buffer[3] * xrange), # xmax - right + bbox[4] + (buffer[4] * yrange) # ymax - top + ) + } else { + print("Missed something while writing the funtion.") + } + +} diff --git a/R/cols_impact.R b/R/cols_impact.R new file mode 100644 index 0000000..c74bdaf --- /dev/null +++ b/R/cols_impact.R @@ -0,0 +1,30 @@ +#' @title Function to extract IMPACT colors as hex codes +#' +#' @param ... Character names of reach colors. If NULL returns all colors +#' @param unnamed Should the output vector be unnamed? Default to `TRUE` +#' +#' @return An hex code or hex codes named or unnamed +#' +#' @details This function needs to be modified to add colors +#' +#' @export +cols_impact <- function(..., unnamed = TRUE) { + cols <- c(...) + + colors_impact <- c(white = "#FFFFFF", + black = "#000000", + main_blue = "#315975", + main_gray = "#58585A") + + if (is.null(cols)) { + cols_to_return <- colors_impact + } else { + cols_to_return <- colors_impact[cols] + } + + if(unnamed){ + cols_to_return <- unname(cols_to_return) + } + + return(cols_to_return) +} diff --git a/R/cols_reach.R b/R/cols_reach.R index 317948d..efb1c54 100644 --- a/R/cols_reach.R +++ b/R/cols_reach.R @@ -11,49 +11,148 @@ cols_reach <- function(..., unnamed = TRUE) { cols <- c(...) - colors_reach <- c(white = "#FFFFFF", - black = "#000000", - main_grey = "#58585A", - main_red = "#EE5859", - main_lt_grey = "#C7C8CA", - main_beige = "#D2CBB8", - iroise_1 = "#DFECEF", - iroise_2 = "#B1D7E0", - iroise_3 = "#699DA3", - iroise_4 = "#236A7A", - iroise_5 = "#0C3842", - red_main_1 = "#AE2829", - red_main_2 = "#D05E5F", - red_main_3 = "#DB9797", - red_main_4 = "#EBC7C8", - red_main_5 = "#FAF2F2", - red_alt_1 = "#792a2e", - red_alt_2 = "#c0474a", - red_alt_3 = "#ee5859", - red_alt_4 = "#f49695", - red_alt_5 = "#f8d6d6", - red_alt_na = "#f8f4f4", - lt_grey_1 = "#C6C6C6", - lt_grey_2 = "#818183", - grey3 = "#E3E3E3", - dk_grey = "#464647", - two_dots_1 = "#706441", - two_dots_2 = "#56b4e9", - two_dots_flashy_1 = "gold1", - two_dots_flashy_2 = "blue2", - three_dots_1 = "aquamarine2", - three_dots_2 = "cornflowerbluer", - three_dots_3 = "brown1", - orpink = "#f8aa9b", - pink = "#f5a6a7", - lt_pink = "#F9C6C7", - hot_pink = "#ef6d6f", - mddk_red = "#bf4749", - dk_red = "#782c2e", - orange = "#F69E61", - lt_green = "#B0CFAC", - green = "#84A181", - dk_green = "#526450") + colors_reach <- c( + white = "#FFFFFF", + black = "#000000", + main_grey = "#58585A", + main_red = "#EE5859", + main_lt_grey = "#C7C8CA", + main_beige = "#D2CBB8", + iroise_1 = "#DFECEF", + iroise_2 = "#B1D7E0", + iroise_3 = "#699DA3", + iroise_4 = "#236A7A", + iroise_5 = "#0C3842", + red_main_1 = "#AE2829", + red_main_2 = "#D05E5F", + red_main_3 = "#DB9797", + red_main_4 = "#EBC7C8", + red_main_5 = "#FAF2F2", + red_alt_1 = "#792a2e", + red_alt_2 = "#c0474a", + red_alt_3 = "#ee5859", + red_alt_4 = "#f49695", + red_alt_5 = "#f8d6d6", + red_alt_na = "#f8f4f4", + lt_grey_1 = "#C6C6C6", + lt_grey_2 = "#818183", + grey3 = "#E3E3E3", + dk_grey = "#464647", + two_dots_1 = "#706441", + two_dots_2 = "#56b4e9", + two_dots_flashy_1 = "gold1", + two_dots_flashy_2 = "blue2", + three_dots_1 = "aquamarine2", + three_dots_2 = "cornflowerblue", + three_dots_3 = "brown1", + orpink = "#f8aa9b", + pink = "#f5a6a7", + lt_pink = "#F9C6C7", + hot_pink = "#ef6d6f", + mddk_red = "#bf4749", + dk_red = "#782c2e", + orange = "#F69E61", + lt_green = "#B0CFAC", + green = "#84A181", + dk_green = "#526450", + red_less_4_1 = "#f6e3e3", + red_less_4_2 = "#f3b5b6", + red_less_4_3 = "#ee5a59", + red_less_4_4 = "#9d393c", + red_5_1 = "#f6e3e3", + red_5_2 = "#f3b5b6", + red_5_3 = "#ee5a59", + red_5_4 = "#c0474a", + red_5_5 = "#792a2e", + red_less_7_1 = "#f8f4f4", + red_less_7_2 = "#f8d6d6", + red_less_7_3 = "#f49695", + red_less_7_4 = "#ee5a59", + red_less_7_5 = "#c0474a", + red_less_7_6 = "#792a2e", + red_less_7_7 = "#471119", + green_2_1 = "#cce5c9", + green_2_2 = "#55a065", + green_3_1 = "#e6f2e0", + green_3_2 = "#7ebf85", + green_3_3 = "#2d8246", + green_4_1 = "#e6f2e1", + green_4_2 = "#b0d3ab", + green_4_3 = "#4bab5e", + green_4_4 = "#0c592e", + green_5_1 = "#e6f2e1", + green_5_2 = "#b0d3ab", + green_5_3 = "#6bb26a", + green_5_4 = "#229346", + green_5_5 = "#0c592e", + green_6_1 = "#e6f2e0", + green_6_2 = "#b0d3ab", + green_6_3 = "#75c376", + green_6_4 = "#086d38", + green_6_5 = "#0c592e", + green_6_6 = "#0d4420", + green_7_1 = "#fafafa", + green_7_2 = "#e6f2e0", + green_7_3 = "#b0d3ab", + green_7_4 = "#75c376", + green_7_5 = "#40ab5d", + green_7_6 = "#086d38", + green_7_7 = "#0d4420", + artichoke_2_1 = "#b6c8b1", + artichoke_2_2 = "#53755f", + artichoke_3_1 = "#e4f1db", + artichoke_3_2 = "#89a087", + artichoke_3_3 = "#455843", + artichoke_4_1 = "#e4f1db", + artichoke_4_2 = "#b5ceb2", + artichoke_4_3 = "#89a087", + artichoke_4_4 = "#465944", + artichoke_5_1 = "#e4f1db", + artichoke_5_2 = "#b5ceb2", + artichoke_5_3 = "#89a087", + artichoke_5_4 = "#60755f", + artichoke_5_5 = "#465944", + artichoke_6_1 = "#fafafa", + artichoke_6_2 = "#e4f1db", + artichoke_6_3 = "#b5ceb2", + artichoke_6_4 = "#89a087", + artichoke_6_5 = "#60755f", + artichoke_6_6 = "#455843", + artichoke_7_1 = "#fafafa", + artichoke_7_2 = "#e4f1db", + artichoke_7_3 = "#b5ceb2", + artichoke_7_4 = "#9fb89c", + artichoke_7_5 = "#89a087", + artichoke_7_6 = "#60755f", + artichoke_7_7 = "#455843", + blue_2_1 = "#7cb6c4", + blue_2_2 = "#286877 ", + blue_3_1 = "#b9d7de", + blue_3_2 = "#5ca4b4", + blue_3_3 = "#286877", + blue_4_1 = "#dfecef", + blue_4_2 = "#8fc1cc", + blue_4_3 = "#3f96aa", + blue_4_4 = "#286877", + blue_5_1 = "#dfecef", + blue_5_2 = "#8fc1cc", + blue_5_3 = "#3f96aa", + blue_5_4 = "#256a7a", + blue_5_5 = "#0c3842", + blue_6_1 = "#f4fbfe", + blue_6_2 = "#cfe4e9", + blue_6_3 = "#77b2bf", + blue_6_4 = "#4096aa", + blue_6_5 = "#256a7a", + blue_6_6 = "#0c3842", + blue_7_1 = "#f4fbfe", + blue_7_2 = "#b3d5de", + blue_7_3 = "#77b2bf", + blue_7_4 = "#4096aa", + blue_7_5 = "#27768a", + blue_7_6 = "#0c596b", + blue_7_7 = "#0c3842" + ) if (is.null(cols)) { cols_to_return <- colors_reach @@ -61,7 +160,7 @@ cols_reach <- function(..., unnamed = TRUE) { cols_to_return <- colors_reach[cols] } - if(unnamed){ + if (unnamed) { cols_to_return <- unname(cols_to_return) } diff --git a/R/data.R b/R/data.R new file mode 100644 index 0000000..8101ff4 --- /dev/null +++ b/R/data.R @@ -0,0 +1,93 @@ +#' Haïti admin 1 centroids shapefile. +#' +#' A multipoint shapefile of Haiti's admin 1. +#' +#' @format A sf multipoint object with 10 features and 9 fields: +#' \describe{ +#' \item{ADM1_PC}{Admin 1 postal code.} +#' \item{ADM1_EN}{Full name in English.} +#' \item{ADM1_FR}{Full name in French.} +#' \item{ADM1_HT}{Full name in Haitian Creole.} +#' \item{ADM0_EN}{Country name in English.} +#' \item{ADM0_FR}{Country name in French.} +#' \item{ADM0_HT}{Country name in Haitian Creole.} +#' \item{ADM0_PC}{Country postal code.} +#' \item{ADM1_FR_UPPER}{Admin 1 French name - uppercase.} +#' \item{geometry}{Multipoint geometry.} +#' } +"centroid_admin1" + + +#' Indicator admin 1 polygons shapefile. +#' +#' A multipolygon shapefile of Haiti's admin 1 with an indicator column 'opn_dfc'. +#' +#' @format A sf multipoint object with 10 features and 10 fields: +#' \describe{ +#' \item{ADM1_PC}{Admin 1 postal code.} +#' \item{admin1}{Admin 1 unique id.} +#' \item{opn_dfc}{Proportion of HHs that reported open defecation as sanitation facility.} +#' \item{ADM1_EN}{Full name in English.} +#' \item{ADM1_FR}{Full name in French.} +#' \item{ADM1_HT}{Full name in Haitian Creole.} +#' \item{ADM0_EN}{Country name in English.} +#' \item{ADM0_FR}{Country name in French.} +#' \item{ADM0_HT}{Country name in Haitian Creole.} +#' \item{ADM0_PC}{Country postal code.} +#' \item{geometry}{Multipolygon geometry.} +#' } +"indicator_admin1" + + +#' Haïti admin 1 lines shapefile. +#' +#' A multiline shapefile of Haiti's admin 1. +#' +#' @format A sf multiline object with 10 features and 8 fields: +#' \describe{ +#' \item{ADM1_EN}{Full name in English.} +#' \item{ADM1_FR}{Full name in French.} +#' \item{ADM1_HT}{Full name in Haitian Creole.} +#' \item{ADM0_EN}{Country name in English.} +#' \item{ADM0_FR}{Country name in French.} +#' \item{ADM0_HT}{Country name in Haitian Creole.} +#' \item{ADM0_PCODE}{Country postal code.} +#' \item{geometry}{Multiline geometry.} +#' } +"line_admin1" + + +#' Haïti border. +#' +#' A multiline shapefile of Haiti's border. +#' +#' @format A sf multiline objet with 1 feature and 6 fields: +#' \describe{ +#' \item{fid_1}{fid_1} +#' \item{uno}{uno} +#' \item{count}{count} +#' \item{x_coord}{x_coord} +#' \item{y_coord}{y_coord} +#' \item{area}{area} +#' \item{geometry}{Multiline geometry.} +#' } +"border_admin0" + + +#' Haïti frontier with Dominican Republic. +#' +#' A multiline shapefile of Haiti's frontier with Dominican Republic. +#' +#' @format A sf multipoint objet with 4 features and 8 fields: +#' \describe{ +#' \item{fid_1}{fid_1} +#' \item{objectid}{objectid} +#' \item{id}{id} +#' \item{fromnode}{fromnode} +#' \item{tonode}{tonode} +#' \item{leftpolygo}{leftpolygo} +#' \item{rightpolygo}{rightpolygo} +#' \item{shape_leng}{shape_leng} +#' \item{geometry}{Multiline geometry.} +#' } +"frontier_admin0" diff --git a/R/donut.R b/R/donut.R new file mode 100644 index 0000000..0c1cd93 --- /dev/null +++ b/R/donut.R @@ -0,0 +1,107 @@ +#' @title Simple donut chart (to be used parsimoniously), can be a pie chart +#' +#' @param df A data frame. +#' @param x A character column or coercible as a character column. Will give the donut's fill color. +#' @param y A numeric column. +#' @param alpha Fill transparency. +#' @param x_title The x scale title. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param arrange TRUE or FALSE. Arrange by highest percentage first. +#' @param hole_size Hole size. Default to 3. If less than 2, back to a pie chart. +#' @param add_text TRUE or FALSE. Add the value as text. +#' @param add_text_treshold_display Minimum value to add the text label. +#' @param add_text_color Text color. +#' @param add_text_suffix If percent is FALSE, should we add a suffix to the text label? +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A donut chart to be used parsimoniously +#' +#' @export +donut <- function(df, + x, + y, + alpha = 1, + x_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + arrange = TRUE, + hole_size = 3, + add_text = TRUE, + add_text_treshold_display = 5, add_text_color = "white", add_text_suffix = "", theme = theme_reach(legend_reverse = TRUE)){ + + # Arrange by biggest prop first ? + if (arrange) df <- dplyr::arrange( + df, + {{ y }} + ) + + # Get levels for scaling + lev <- dplyr::pull(df, {{ x }}) + df <- dplyr::mutate(df, "{{x}}" := factor({{ x }}, levels = lev)) + + # Mapping + g <- ggplot2::ggplot( + df, + mapping = ggplot2::aes( + x = hole_size, + y = {{ y }}, + fill = {{ x }}, + color = {{ x }} + ) + ) + + # Add rect + g <- g + ggplot2::geom_col(alpha = alpha) + + + # Add text labels + if (add_text) { + + df <- dplyr::mutate(df, y_treshold = ifelse({{ y }} >= add_text_treshold_display, {{ y }}, NA )) + + g <- g + + ggplot2::geom_text( + data = df, + ggplot2::aes( + x = hole_size, + y = !!rlang::sym("y_treshold"), + label = paste0({{ y }}, add_text_suffix)), + color = add_text_color, + position = ggplot2::position_stack(vjust = 0.5)) + } + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + fill = x_title, + color = x_title + ) + + # Transform to polar coordinates and adjust hole + g <- g + + ggplot2::coord_polar( + theta = "y" + ) + + if (hole_size >= 2) g <- g + ggplot2::xlim(c(1, hole_size + 0.5)) # Try to remove that to see how to make a pie chart + + # Add theme + g <- g + theme + + # No axis + g <- g + ggplot2::theme( + axis.text = ggplot2::element_blank(), + axis.line = ggplot2::element_blank(), + axis.ticks = ggplot2::element_blank(), + axis.title = ggplot2::element_blank() + ) + + + return(g) + +} diff --git a/R/dumbbell.R b/R/dumbbell.R new file mode 100644 index 0000000..18f0e9a --- /dev/null +++ b/R/dumbbell.R @@ -0,0 +1,161 @@ +#' Make dumbbell chart. +#' +#' @param df A data frame. +#' @param col A numeric column. +#' @param group_x The grouping column on the x-axis; only two groups. +#' @param group_y The grouping column on the y-axis. +#' @param point_size Point size. +#' @param point_alpha Point alpha. +#' @param segment_size Segment size. +#' @param segment_color Segment color. +#' @param group_x_title X-group and legend title. +#' @param group_y_title Y-axis and group title. +#' @param x_title X-axis title. +#' @param title Title. +#' @param subtitle Subtitle. +#' @param caption Caption. +#' @param line_to_y_axis TRUE or FALSE; add a line connected points and Y-axis. +#' @param line_to_y_axis_type Line to Y-axis type. +#' @param line_to_y_axis_width Line to Y-axis width. +#' @param line_to_y_axis_color Line to Y-axis color. +#' @param add_text TRUE or FALSE; add text at the points. +#' @param add_text_vjust Vertical adjustment. +#' @param add_text_size Text size. +#' @param add_text_color Text color. +#' @param theme A ggplot2 theme, default to `theme_reach()` +#' +#' @return A dumbbell chart. +#' @export +#' +dumbbell <- function(df, + col, + group_x, + group_y, + point_size = 5, + point_alpha = 1, + segment_size = 2.5, + segment_color = cols_reach("main_lt_grey"), + group_x_title = NULL, + group_y_title = NULL, + x_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + line_to_y_axis = TRUE, + line_to_y_axis_type = 3, + line_to_y_axis_width = 0.5, + line_to_y_axis_color = cols_reach("main_grey"), + add_text = TRUE, + add_text_vjust = 2, + add_text_size = 3.5, + add_text_color = cols_reach("main_grey"), + theme = theme_reach(palette = "primary")){ + + # Get group keys + group_x_keys <- df |> + dplyr::group_by({{ group_x }}) |> + dplyr::group_keys() |> + dplyr::pull() + + # Check if only two groups + if (length(group_x_keys) > 2) rlang::abort("Cannot draw a dumbbell plot for `group_x` with more than 2 groups") + + # Pivot long data + df_pivot <- df |> + tidyr::pivot_wider( + id_cols = c({{ group_y}}), + values_from = {{ col }}, + names_from = {{ group_x }} + ) + + df_pivot <- df_pivot |> + dplyr::rowwise() |> + dplyr::mutate( + min = min(!!rlang::sym(group_x_keys[[1]]), !!rlang::sym(group_x_keys[[2]]), na.rm = T), + max = max(!!rlang::sym(group_x_keys[[1]]), !!rlang::sym(group_x_keys[[2]]), na.rm = T)) |> + dplyr::ungroup() |> + dplyr::mutate(diff = max - min) + + g <- ggplot2::ggplot(df_pivot) + + # Add line + if(line_to_y_axis) { + + xend <- min(dplyr::pull(df, {{ col }})) + + g <- g + + ggplot2::geom_segment( + ggplot2::aes( + x = min, + y = {{ group_y }}, + yend = {{ group_y }}), + xend = xend, + linetype = line_to_y_axis_type, + size = line_to_y_axis_width, + color = line_to_y_axis_color) + } + + # Add segment + g <- g + + ggplot2::geom_segment( + ggplot2::aes( + x = !!rlang::sym(group_x_keys[[1]]), + y = {{ group_y }}, + xend = !!rlang::sym(group_x_keys[[2]]), + yend = {{ group_y }}), + size = segment_size, + color = segment_color + ) + + # Add points + g <- g + + ggplot2::geom_point( + data = df, + ggplot2::aes( + x = {{ col }}, + y = {{ group_y }}, + color = {{ group_x }}, + fill = {{ group_x }} + ), + size = point_size, + alpha = point_alpha + ) + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + x = x_title, + y = group_y_title, + color = group_x_title, + fill = group_x_title + ) + + # Add stat labels to points + if(add_text) g <- g + + ggrepel::geom_text_repel( + data = df, + ggplot2::aes( + x = {{ col }}, + y = {{ group_y}}, + label = {{ col }} + ), + vjust = add_text_vjust, + size = add_text_size, + color = add_text_color + ) + + # Expan y axis + # g <- g + + # ggplot2::scale_y_discrete( + # group_y_title, + # expand = c(0, 0)) + + + # Add theme + g <- g + theme + + return(g) + +} diff --git a/R/internals.R b/R/internals.R new file mode 100644 index 0000000..0f145b5 --- /dev/null +++ b/R/internals.R @@ -0,0 +1,95 @@ +#' @title Abord bad argument +#' +#' @param arg An argument +#' @param must What arg must be +#' @param not Optional. What arg must not be. +#' +#' @return A stop statement +abort_bad_argument <- function(arg, must, not = NULL) { + msg <- glue::glue("`{arg}` must {must}") + if (!is.null(not)) { + not <- typeof(not) + msg <- glue::glue("{msg}; not {not}.") + } + + rlang::abort("error_bad_argument", + message = msg, + arg = arg, + must = must, + not = not + ) +} + + + +#' @title Stop statement "If not in colnames" with colnames +#' +#' @param .tbl A tibble +#' @param cols A vector of column names (quoted) +#' @param df Provide the tibble name as a character string +#' @param arg Default to NULL. +#' +#' @return A stop statement +if_not_in_stop <- function(.tbl, cols, df, arg = NULL){ + if (is.null(arg)) { + msg <- glue::glue("The following column/s is/are missing in `{df}`:") + } + else { + msg <- glue::glue("The following column/s from `{arg}` is/are missing in `{df}`:") + } + if (!all(cols %in% colnames(.tbl))) { + rlang::abort( + c("Missing columns", + "*" = + paste( + msg, + paste( + subvec_not_in(cols, colnames(.tbl)), + collapse = ", ") + ) + ) + ) + } +} + + + +#' @title Stop statement "If not in vector" +#' +#' @param vec A vector of character strings +#' @param cols A set of character strings +#' @param vec_name Provide the vector name as a character string +#' @param arg Default to NULL. +#' +#' @return A stop statement if some elements of vec are not in cols +if_vec_not_in_stop <- function(vec, cols, vec_name, arg = NULL){ + if (is.null(arg)) { + msg <- glue::glue("The following element/s is/are missing in `{vec_name}`:") + } + else { + msg <- glue::glue("The following element/s from `{arg}` is/are missing in `{vec_name}`:") + } + if (!all(cols %in% vec)) { + rlang::abort( + c("Missing elements", + "*" = + paste( + msg, + paste( + subvec_not_in(cols, vec), + collapse = ", ") + ) + ) + ) + } +} + +#' @title Subvec not in +#' +#' @param vector A vector to subset +#' @param set A set-vector +#' +#' @return A subset of vector not in set +subvec_not_in <- function(vector, set){ + vector[!(vector %in% set)] +} diff --git a/R/lollipop.R b/R/lollipop.R new file mode 100644 index 0000000..60de655 --- /dev/null +++ b/R/lollipop.R @@ -0,0 +1,121 @@ +#' @title Simple bar chart +#' +#' @param df A data frame. +#' @param x A numeric column. +#' @param y A character column or coercible as a character column. +#' @param flip TRUE or FALSE. Default to TRUE or horizontal lollipop plot. +#' @param wrap Should x-labels be wrapped? Number of characters. +#' @param arrange TRUE or FALSE. Arrange by highest percentage first. +#' @param point_size Point size. +#' @param point_color Point color. +#' @param point_alpha Point alpha. +#' @param segment_size Segment size. +#' @param segment_color Segment color. +#' @param segment_alpha Segment alpha. +#' @param alpha Fill transparency. +#' @param x_title The x scale title. Default to NULL. +#' @param y_title The y scale title. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param add_text TRUE or FALSE. Add the y value as text within the bubble. +#' @param add_text_size Text size. +#' @param add_text_suffix If percent is FALSE, should we add a suffix to the text label? +#' @param add_text_color Added text color. Default to white. +#' @param add_text_fontface Added text font face. Default to "bold". +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A bar chart +#' +#' @export +lollipop <- function(df, + x, + y, + flip = TRUE, + wrap = NULL, + arrange = TRUE, + point_size = 3, + point_color = cols_reach("main_red"), + point_alpha = 1, + segment_size = 1, + segment_color = cols_reach("main_grey"), + segment_alpha = 1, + alpha = 1, + x_title = NULL, + y_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + add_text = FALSE, + add_text_size = 3, + add_text_suffix = "", + add_text_color = "white", + add_text_fontface = "bold", + theme = theme_reach()){ + + + # Arrange by biggest prop first ? + if (arrange) df <- dplyr::arrange( + df, + {{ y }} + ) + + # Get levels for scaling + lev <- dplyr::pull(df, {{ x }}) + df <- dplyr::mutate(df, "{{x}}" := factor({{ x }}, levels = lev)) + + # Mapping + g <- ggplot2::ggplot( + df, + mapping = ggplot2::aes(x = {{ x }}, y = {{ y }}, xend = {{ x }}, yend = 0) + ) + + # Add segment + g <- g + ggplot2::geom_segment( + linewidth = segment_size, + alpha = segment_alpha, + color = segment_color + ) + + g <- g + ggplot2::geom_point( + size = point_size, + alpha = point_alpha, + color = point_color + ) + + if (!is.null(wrap)) { + g <- g + ggplot2::scale_x_discrete(labels = scales::label_wrap(wrap)) + } + + # Because a text legend should always be horizontal, especially for an horizontal bar graph + if (flip){ + g <- g + ggplot2::coord_flip() + } + + # Add text labels + if (add_text) { + g <- g + ggplot2::geom_text( + ggplot2::aes( + label = paste0({{ y }}, add_text_suffix)), + size = add_text_size, + color = add_text_color, + fontface = add_text_fontface) + } + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + x = x_title, + y = y_title, + ) + + + # Add theme + g <- g + theme + + return(g) + +} + diff --git a/R/map.R b/R/map.R new file mode 100644 index 0000000..3e9ac1b --- /dev/null +++ b/R/map.R @@ -0,0 +1,354 @@ + + +#' Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values +#' +#' @param poly Multipolygon shape defined by sf package. +#' @param col Numeric attribute to map. +#' @param buffer A buffer, either one value or a vector of 4 values (left, bottom, right, top). +#' @param n The desire number of classes. +#' @param style Method to process the color scale for continuous numerical variables. See `classInt::classIntervals()` for details. +#' @param palette Vector of fill colors as hexadecimal values. For REACH color palettes, it is possible to use `pal_reach()`. For now,'palette' must be changed manually, accordingly to the number of drawn classes. +#' @param as_count Boolean. When col is a numeric variable, should it be processed as a count variable? For instance, 0, 1-10, 11-20. +#' @param color_na Fill color for missing data. +#' @param text_na Legend text for missing data. +#' @param legend_title Legend title. +#' @param legend_text_separator Text separator for classes. E.g. " to " will give 0, 1 to 10, 11 to 20. +#' @param border_alpha Transparency of the border. +#' @param border_col Color of the border. +#' @param lwd Linewidth of the border. +#' @param ... Other arguments to pass to `tmap::tm_polygons()`. +#' +#' @return A tmap layer. +#' @export +#' +add_indicator_layer <- function( + poly, + col, + buffer = NULL, + n = 5, + style = "pretty", + palette = pal_reach("red_5"), + as_count = TRUE, + color_na = cols_reach("white"), + text_na = "Missing data", + legend_title = "Proportion (%)", + legend_text_separator = " - ", + border_alpha = 1, + border_col = cols_reach("lt_grey_1"), + lwd = 1, + ...){ + + #------ Checks and make valid + + rlang::check_installed("tmap", reason = "Package \"tmap\" needed for `add_indicator_layer()` to work. Please install it.") + + poly <- sf::st_make_valid(poly) + + #------ Other checks + + col_name <- rlang::as_name(rlang::enquo(col)) + if_not_in_stop(poly, col_name, "poly", "col") + + if (!is.numeric(poly[[col_name]])) rlang::abort(glue::glue("{col_name} is not numeric.")) + + + #------ Prepare data + + if(!is.null(buffer)){ buffer <- buffer_bbox(poly, buffer) } else { buffer <- NULL } + + + #------ Polygon layer + + layer <- tmap::tm_shape( + poly, + bbox = buffer + ) + + tmap::tm_polygons( + col = col_name, + n = n, + style = style, + palette = palette, + as.count = as_count, + colorNA = color_na, + textNA = text_na, + title = legend_title, + legend.format = list(text.separator = legend_text_separator), + borderl.col = border_col, + border.alpha = border_alpha, + lwd = lwd, + ... + ) + + return(layer) + +} + + + + +#' Add admin boundaries (lines) and the legend +#' +#' @param lines List of multiline shape defined by sf package. +#' @param colors Vector of hexadecimal codes. Same order as lines. +#' @param labels Vector of labels in the legend. Same order as lines. +#' @param lwds Vector of line widths. Same order as lines. +#' @param title Legend title. +#' @param buffer A buffer, either one value or a vector of 4 values (left, bottom, right, top). +#' @param ... Other arguments to pass to each shape in `tmap::tm_lines()`. +#' +#' @return A tmap layer. +#' @export +#' +add_admin_boundaries <- function(lines, colors, labels, lwds, title = "", buffer = NULL, ...){ + + + #------ Package check + + rlang::check_installed("tmap", reason = "Package \"tmap\" needed for `add_admin_boundaries()` to work. Please install it.") + + + #------ Check that the length of vectors is identical between arguments + + if(!inherits(lines, "list")) rlang::abort("Please provide a list for lines.") + + ll <- list(lines, colors, labels, lwds) + if (!all(sapply(ll,length) == length(ll[[1]]))) rlang::abort("lines, colors, labels, lwds do not all have the same length.") + + + #------ Make valid + + lines <- lapply(lines, \(x) sf::st_make_valid(x)) + + + #------ Prepare legend + legend_lines <- tmap::tm_add_legend("line", + title = title, + col = colors, + lwd = lwds, + labels = labels) + + + #------ Let's go with all line shapes + + if(!is.null(buffer)){ buffer <- buffer_bbox(lines[[1]], buffer) } else { buffer <- NULL } + + + layers <- tmap::tm_shape(lines[[1]], bbox = buffer) + + tmap::tm_lines(lwd = lwds[[1]], col = colors[[1]], ...) + + if (length(lines) == 1) { + + layers <- layers + legend_lines + + return(layers) + + } else { + + for(i in 2:length(lines)){ + + layers <- layers + tmap::tm_shape(shp = lines[[i]]) + tmap::tm_lines(lwd = lwds[[i]], col = colors[[i]], ...) + } + + layers <- layers + legend_lines + + return(layers) + + } +} + + + + +#' Basic defaults based on `tmap::tm_layout()` +#' +#' @param title Map title. +#' @param legend_position Legend position. Not above the map is a good start. +#' @param frame Boolean. Legend frame? +#' @param legend_frame Legend frame color. +#' @param legend_text_size Legend text size in 'pt'. +#' @param legend_title_size Legend title size in 'pt'. +#' @param title_size Title text size in 'pt'. +#' @param title_fontface Title fontface. Bold if you wanna exemplify a lot what it is about. +#' @param title_color Title font color. +#' @param fontfamily Overall fontfamily. Leelawadee is your precious. +#' @param ... Other arguments to pass to `tmap::tm_layout()`. +#' +#' @return A tmap layer. +#' @export +#' +add_layout <- function( + title = NULL, + legend_position = c(0.02, 0.5), + frame = FALSE, + legend_frame = cols_reach("main_grey"), + legend_text_size = 0.6, + legend_title_size = 0.8, + title_size = 0.9, + title_fontface = "bold", + title_color = cols_reach("main_grey"), + # check.and.fix = TRUE, + fontfamily = "Leelawadee", + ...){ + + layout <- tmap::tm_layout( + title = title, + legend.position = legend_position, + legend.frame = legend_frame, + frame = FALSE, + legend.text.size = legend_text_size, + legend.title.size = legend_title_size, + title.size = title_size, + title.fontface = title_fontface, + title.color = title_color, + fontfamily = fontfamily, + ...) + + return(layout) + + } + + + + +#' Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. +#' +#' @param point Multipoint shape defined by sf package. +#' @param text Text labels column. +#' @param size Relative size of the text labels. +#' @param fontface Fontface. +#' @param fontfamily Fontfamily. Leelawadee is your precious. +#' @param shadow Boolean. Add a shadow around text labels. Issue opened on Github to request. +#' @param auto_placement Logical that determines whether the labels are placed automatically. +#' @param remove_overlap Logical that determines whether the overlapping labels are removed. +#' @param ... Other arguments to pass to `tmap::tm_text()`. +#' +#' @return A tmap layer. +#' @export +#' +add_admin_labels <- function(point, + text, + size = 0.5, + fontface = "bold", + fontfamily = "Leelawadee", + shadow = TRUE, + auto_placement = FALSE, + remove_overlap = FALSE, + ...){ + + + #------ Restrictive sf checks (might not be necessary depending on the desired behaviour) + + rlang::check_installed("tmap", reason = "Package \"tmap\" needed for `add_indicator_layer()` to work. Please install it.") + + point <- sf::st_make_valid(point) + + #------ Other checks + + text_name <- rlang::as_name(rlang::enquo(text)) + if_not_in_stop(point, text_name, "point", "text") + + #------ Point text layer + + layer <- tmap::tm_shape(point) + + tmap::tm_text(text = text_name, + size = size, + fontface = fontface, + fontfamily = fontfamily, + shadow = shadow, + auto.placement = auto_placement, + remove.overlap = remove_overlap, + ...) + + return(layer) + +} + + + + +#' Add a compass +#' +#' @param text_size Relative font size. +#' @param position Position of the compass. Vector of two values, specifying the x and y coordinates. +#' @param color_dark Color of the dark parts of the compass. +#' @param text_color color of the text. +#' @param type Compass type, one of: "arrow", "4star", "8star", "radar", "rose". +#' @param ... Other arguments to pass to `tmap::tm_compass()`. +#' +#' @return A tmap layer. +#' @export +#' +add_compass <- function(text_size = 0.6, + position = c("right", 0.8), + color_dark = cols_reach("black"), + text_color = cols_reach("black"), + type = "4star", + ...){ + + compass <- tmap::tm_compass( + text.size = text_size, + position = position, + color.dark = color_dark, + type = type, + text.color = text_color + ) + + return(compass) + +} + + + + +#' Add a scale bar +#' +#' @param text_size Relative font size. +#' @param position Position of the compass. Vector of two values, specifying the x and y coordinates. +#' @param color_dark Color of the dark parts of the compass. +#' @param breaks Breaks of the scale bar. If not specified, breaks will be automatically be chosen given the prefered width of the scale bar. Example: c(0, 50, 100). +#' @param ... Other arguments to pass to `tmap::tm_compass()`. +#' +#' @return A tmap layer. +#' @export +#' +add_scale_bar <- function(text_size = 0.6, + position = c("left", 0.01), + color_dark = cols_reach("black"), + breaks = c(0, 50, 100), + ...){ + + scale_bar <- tmap::tm_scale_bar( + text.size = text_size, + position = position, + color.dark = color_dark, + breaks = breaks, + ... + ) + + return(scale_bar) + +} + + + + +#' Do you want to credit someone or some institution? +#' +#' @param text Text. +#' @param size Relative text size. +#' @param bg_color Background color. +#' @param position Position. Vector of two coordinates. Usually somewhere down. +#' @param ... Other arguments to pass to `tmap::tm_credits()`. +#' +#' @return A tmap layer. +#' @export +#' +add_credits <- function(text, size = 0.4, bg_color = NA, position = c(0.75, 0.02), ...){ + + tmap::tm_credits(text, + size = size, + bg.color = bg_color, + position = position, + ...) +} + diff --git a/R/pal_agora.R b/R/pal_agora.R index 90f08a6..756e9d8 100644 --- a/R/pal_agora.R +++ b/R/pal_agora.R @@ -13,15 +13,9 @@ pal_agora <- function(palette = "main", reverse = FALSE, color_ramp_palette = FA palettes_agora <- list( - `main` = cols_agora("main_grey", "main_red", "main_lt_grey", "main_beige"), - `primary` = cols_agora("main_grey", "main_red"), - `secondary` = cols_agora("main_lt_grey", "main_beige"), - `two_dots` = cols_agora("two_dots_1", "two_dots_2"), - `two_dots_flashy` = cols_agora("two_dots_flashy_1", "two_dots_flashy_2"), - `red_main` = cols_agora("red_main_1", "red_main_2", "red_main_3", "red_main_4", "red_main_5"), - `red_alt` = cols_agora("red_alt_1", "red_alt_2", "red_alt_3", "red_alt_4", "red_alt_5"), - `iroise` = cols_agora("iroise_1", "iroise_2", "iroise_3", "iroise_4", "iroise_5"), - `discrete_6` = cols_agora("dk_grey", "red_main_1", "main_beige", "red_main_2", "lt_grey_2", "red_4") + `main` = cols_agora("main_bordeaux", "main_dk_beige", "main_lt_grey", "main_lt_beige"), + `primary` = cols_agora("main_bordeaux", "main_dk_beige"), + `secondary` = cols_agora( "main_lt_grey", "main_lt_beige") ) if (show_palettes) return(names(palettes_agora)) diff --git a/R/pal_fallback.R b/R/pal_fallback.R new file mode 100644 index 0000000..0fb7b23 --- /dev/null +++ b/R/pal_fallback.R @@ -0,0 +1,30 @@ +#' @title Return function to interpolate a fallback palette base on viridis::magma() +#' +#' @param reverse Boolean indicating whether the palette should be reversed +#' @param color_ramp_palette Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the latter with `FALSE` +#' @param discrete Boolean. Discrete or not? Default to FALSE. +#' @param n Number of colors in the palette. Default to 5. Passe to `viridis::magma()` +#' @param ... Other parameters to pass to `grDevices::colorRampPalette()` +#' +#' @return A color palette +#' +#' @export +pal_fallback <- function(reverse = FALSE, + color_ramp_palette = FALSE, + discrete = FALSE, + n = 5, + ...){ + + pal <- if(discrete) { viridisLite::viridis(n) } else {viridisLite::magma(n)} + + if (reverse) pal <- rev(pal) + + if (color_ramp_palette) { + rlang::check_installed("grDevices", reason = "Package \"grDevices\" needed for `pal_fallback()` with 'color_ramp_palette' set to `TRUE` to work. Please install it.") + + pal <- grDevices::colorRampPalette(pal, ...) + } + + return(pal) + +} diff --git a/R/pal_impact.R b/R/pal_impact.R new file mode 100644 index 0000000..ff9b561 --- /dev/null +++ b/R/pal_impact.R @@ -0,0 +1,34 @@ +#' @title Return function to interpolate an IMPACT color palette +#' +#' @param palette Character name of a palette in IMPACT palettes +#' @param reverse Boolean indicating whether the palette should be reversed +#' @param color_ramp_palette Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the former with `TRUE` +#' @param show_palettes Should the ouput be the set of palettes names to pick from? Default to `FALSE` +#' @param ... Additional arguments to pass to colorRampPalette() +#' +#' @return A color palette +#' +#' @export +pal_impact <- function(palette = "main", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ...) { + + + palettes_impact <- list( + `main` = cols_impact("black", "white", "main_blue", "main_grey"), + `primary` = cols_impact("black", "white"), + `secondary` = cols_impact("main_blue", "main_grey") + ) + + if (show_palettes) return(names(palettes_impact)) + + pal <- palettes_impact[[palette]] + + if (reverse) pal <- rev(pal) + + if (color_ramp_palette) { + rlang::check_installed("grDevices", reason = "Package \"grDevices\" needed for `pal_impact()` woth 'color_ramp_palette' set to `TRUE` to work. Please install it.") + + pal <- grDevices::colorRampPalette(pal, ...) + } + + return(pal) +} diff --git a/R/pal_reach.R b/R/pal_reach.R index 4fd58bf..7472c08 100644 --- a/R/pal_reach.R +++ b/R/pal_reach.R @@ -1,40 +1,66 @@ -#' @title Return function to interpolate a REACH color palette -#' -#' @param palette Character name of a palette in REACH palettes -#' @param reverse Boolean indicating whether the palette should be reversed -#' @param color_ramp_palette Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the former with `TRUE` -#' @param show_palettes Should the ouput be the set of palettes names to pick from? Default to `FALSE` -#' @param ... Additional arguments to pass to colorRampPalette() -#' -#' @return A color palette -#' -#' @export -pal_reach <- function(palette = "main", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ...) { - - - palettes_reach <- list( - `main` = cols_reach("main_grey", "main_red", "main_lt_grey", "main_beige"), - `primary` = cols_reach("main_grey", "main_red"), - `secondary` = cols_reach("main_lt_grey", "main_beige"), - `two_dots` = cols_reach("two_dots_1", "two_dots_2"), - `two_dots_flashy` = cols_reach("two_dots_flashy_1", "two_dots_flashy_2"), - `red_main` = cols_reach("red_main_1", "red_main_2", "red_main_3", "red_main_4", "red_main_5"), - `red_alt` = cols_reach("red_alt_1", "red_alt_2", "red_alt_3", "red_alt_4", "red_alt_5"), - `iroise` = cols_reach("iroise_1", "iroise_2", "iroise_3", "iroise_4", "iroise_5"), - `discrete_6` = cols_reach("dk_grey", "red_main_1", "main_beige", "red_main_2", "lt_grey_2", "red_4") - ) - - if (show_palettes) return(names(palettes_reach)) - - pal <- palettes_reach[[palette]] - - if (reverse) pal <- rev(pal) - - if (color_ramp_palette) { - rlang::check_installed("grDevices", reason = "Package \"grDevices\" needed for `pal_reach()` woth 'color_ramp_palette' set to `TRUE` to work. Please install it.") - - pal <- grDevices::colorRampPalette(pal, ...) - } - - return(pal) -} +#' @title Return function to interpolate a REACH color palette +#' +#' @param palette Character name of a palette in REACH palettes +#' @param reverse Boolean indicating whether the palette should be reversed +#' @param color_ramp_palette Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the former with `TRUE` +#' @param show_palettes Should the ouput be the set of palettes names to pick from? Default to `FALSE` +#' @param ... Additional arguments to pass to colorRampPalette() +#' +#' @return A color palette +#' +#' @export +pal_reach <- function(palette = "main", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ...) { + + palettes_reach <- list( + `main` = cols_reach("main_grey", "main_red", "main_lt_grey", "main_beige"), + `primary` = cols_reach("main_grey", "main_red"), + `secondary` = cols_reach("main_lt_grey", "main_beige"), + `two_dots` = cols_reach("two_dots_1", "two_dots_2"), + `two_dots_flashy` = cols_reach("two_dots_flashy_1", "two_dots_flashy_2"), + `red_main` = cols_reach("red_main_1", "red_main_2", "red_main_3", "red_main_4", "red_main_5"), + `red_main_5` = cols_reach("red_main_1", "red_main_2", "red_main_3", "red_main_4", "red_main_5"), + `red_alt` = cols_reach("red_alt_1", "red_alt_2", "red_alt_3", "red_alt_4", "red_alt_5"), + `red_alt_5` = cols_reach("red_alt_1", "red_alt_2", "red_alt_3", "red_alt_4", "red_alt_5"), + `iroise` = cols_reach("iroise_1", "iroise_2", "iroise_3", "iroise_4", "iroise_5"), + `iroise_5` = cols_reach("iroise_1", "iroise_2", "iroise_3", "iroise_4", "iroise_5"), + `discrete_6` = cols_reach("dk_grey", "red_main_1", "main_beige", "red_main_2", "lt_grey_2", "red_4"), + `red_2` = cols_reach("red_less_4_1", "red_less_4_3"), + `red_3` = cols_reach("red_less_4_1", "red_less_4_2", "red_less_4_3"), + `red_4` = cols_reach("red_less_4_1", "red_less_4_2", "red_less_4_3", "red_less_4_4"), + `red_5` = cols_reach("red_5_1", "red_5_2", "red_5_3", "red_5_4", "red_5_5"), + `red_6` = cols_reach("red_less_7_1", "red_less_2", "red_less_7_3", "red_less_7_4", "red_less_7_5", "red_less_7_6"), + `red_7` = cols_reach("red_less_7_1", "red_less_7_2", "red_less_7_3", "red_less_7_4", "red_less_7_5", "red_less_7_6", "red_less_7_7"), + `green_2` = cols_reach("green_2_1", "green_2_2"), + `green_3` = cols_reach("green_3_1", "green_3_2", "green_3_3"), + `green_4` = cols_reach("green_4_1", "green_4_2", "green_4_3", "green_4_4"), + `green_5` = cols_reach("green_5_1", "green_5_2", "green_5_3", "green_5_4", "green_5_5"), + `green_6` = cols_reach("green_6_1", "green_6_2", "green_6_3", "green_6_4", "green_6_5", "green_6_6"), + `green_7` = cols_reach("green_7_1", "green_7_2", "green_7_3", "green_7_4", "green_7_5", "green_7_6", "green_7_7"), + `artichoke_2` = cols_reach("artichoke_2_1", "artichoke_2_2"), + `artichoke_3` = cols_reach("artichoke_3_1", "artichoke_3_2", "artichoke_3_3"), + `artichoke_4` = cols_reach("artichoke_4_1", "artichoke_4_2", "artichoke_4_3", "artichoke_4_4"), + `artichoke_5` = cols_reach("artichoke_5_1", "artichoke_5_2", "artichoke_5_3", "artichoke_5_4", "artichoke_5_5"), + `artichoke_6` = cols_reach("artichoke_6_1", "artichoke_6_2", "artichoke_6_3", "artichoke_6_4", "artichoke_6_5", "artichoke_6_6"), + `artichoke_7` = cols_reach("artichoke_7_1", "artichoke_7_2", "artichoke_7_3", "artichoke_7_4", "artichoke_7_5", "artichoke_7_6", "artichoke_7_7"), + `blue_2` = cols_reach("blue_2_1", "blue_2_2"), + `blue_3` = cols_reach("blue_3_1", "blue_3_2", "blue_3_3"), + `blue_4` = cols_reach("blue_4_1", "blue_4_2", "blue_4_3", "blue_4_4"), + `blue_5` = cols_reach("blue_5_1", "blue_5_2", "blue_5_3", "blue_5_4", "blue_5_5"), + `blue_6` = cols_reach("blue_6_1", "blue_6_2", "blue_6_3", "blue_6_4", "blue_6_5", "blue_6_6"), + `blue_7` = cols_reach("blue_7_1", "blue_7_2", "blue_7_3", "blue_7_4", "blue_7_5", "blue_7_6", "blue_7_7") + ) + + if (show_palettes) return(names(palettes_reach)) + + pal <- palettes_reach[[palette]] + + if (reverse) pal <- rev(pal) + + if (color_ramp_palette) { + rlang::check_installed("grDevices", reason = "Package \"grDevices\" needed for `pal_reach()` with 'color_ramp_palette' set to `TRUE` to work. Please install it.") + + pal <- grDevices::colorRampPalette(pal, ...) + } + + return(pal) +} diff --git a/R/point.R b/R/point.R new file mode 100644 index 0000000..9dae4bf --- /dev/null +++ b/R/point.R @@ -0,0 +1,81 @@ +#' @title Simple point chart +#' +#' @param df A data frame. +#' @param x A numeric column. +#' @param y A character column or coercible as a character column. +#' @param group Some grouping categorical column, e.g. administrative areas or population groups. +#' @param flip TRUE or FALSE. Default to TRUE or horizontal bar plot. +#' @param alpha Fill transparency. +#' @param size Point size. +#' @param x_title The x scale title. Default to NULL. +#' @param y_title The y scale title. Default to NULL. +#' @param group_title The group legend title. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A bar chart +#' +#' @export +point <- function(df, x, y, group = NULL, flip = TRUE, alpha = 1, size = 1, x_title = NULL, y_title = NULL, group_title = NULL, title = NULL, subtitle = NULL, caption = NULL, theme = theme_reach()){ + + # To do : + # - automate bar width and text size, or at least give the flexibility and still center text + # - add facet possibility + + # Prepare group, x and y names + # if (is.null(x_title)) x_title <- rlang::as_name(rlang::enquo(x)) + # if (is.null(y_title)) y_title <- rlang::as_name(rlang::enquo(y)) + # if (is.null(group_title)) group_title <- rlang::as_name(rlang::enquo(group)) + + # Mapping + g <- ggplot2::ggplot( + df, + mapping = ggplot2::aes(x = {{ x }}, y = {{ y }}, fill = {{ group }}, color = {{ group }} + ) + ) + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + x = x_title, + y = y_title, + color = group_title, + fill = group_title + ) + + width <- 0.5 + dodge_width <- 0.5 + + # Should the graph use position_fill? + g <- g + ggplot2::geom_point( + alpha = alpha, + size = size + ) + + # Labels to percent and expand scale + # if (percent) { + # g <- g + ggplot2::scale_y_continuous( + # labels = scales::label_percent( + # accuracy = 1, + # decimal.mark = ",", + # suffix = " %"), + # expand = c(0.01, 0.1) + # ) + # } else { + # g <- g + ggplot2::scale_y_continuous(expand = c(0.01, 0.1)) + # } + + # # Because a text legend should always be horizontal, especially for an horizontal bar graph + if (flip){ + g <- g + ggplot2::coord_flip() + } + + # Add theme + g <- g + theme + + return(g) +} diff --git a/R/scale.R b/R/scale.R index ae7671b..b1a8ccd 100644 --- a/R/scale.R +++ b/R/scale.R @@ -1,77 +1,248 @@ -#' Color scale constructor for REACH or AGORA colors -#' -#' @param initiative Either "reach" or "agora -#' @param palette Character name of palette in drsimonj_palettes -#' @param discrete Boolean indicating whether color aesthetic is discrete or not -#' @param reverse Boolean indicating whether the palette should be reversed -#' @param ... Additional arguments passed to discrete_scale() or -#' scale_color_gradientn(), used respectively when discrete is TRUE or FALSE -#' @return A color scale for ggplot -#' -#' @export -scale_color <- function(initiative = "reach", palette = "main", discrete = TRUE, reverse = FALSE, ...) { - - if (initiative == "reach") { - pal <- pal_reach( - palette = palette, - reverse = reverse, - color_ramp_palette = TRUE, - show_palettes = FALSE - ) - } else if (initiative == "agora") { - pal <- pal_agora( - palette = palette, - reverse = reverse, - color_ramp_palette = TRUE, - show_palettes = FALSE - ) - } else { - rlang::abort(c("Wrong initiative parameter input", "*" = paste0(initiative, "is not an option"), "i" = "Parameter 'initiative' should be one of 'reach' or 'agora'")) - } - - if (discrete) { - ggplot2::discrete_scale("colour", paste0(initiative, "_", palette), palette = pal, ...) - } else { - ggplot2::scale_color_gradientn(colours = pal(256), ...) - } -} - - - -#' Fill scale constructor for REACH or AGORA colors -#' -#' @param initiative Either "reach" or "agora -#' @param palette Character name of palette in drsimonj_palettes -#' @param discrete Boolean indicating whether color aesthetic is discrete or not -#' @param reverse Boolean indicating whether the palette should be reversed -#' @param ... Additional arguments passed to discrete_scale() or -#' scale_fill_gradientn(), used respectively when discrete is TRUE or FALSE -#' @return A fill scale for ggplot -#' -#' @export -scale_color <- function(initiative = "reach", palette = "main", discrete = TRUE, reverse = FALSE, ...) { - - if (initiative == "reach") { - pal <- pal_reach( - palette = palette, - reverse = reverse, - color_ramp_palette = TRUE, - show_palettes = FALSE - ) - } else if (initiative == "agora") { - pal <- pal_agora( - palette = palette, - reverse = reverse, - color_ramp_palette = TRUE, - show_palettes = FALSE - ) - } else { - rlang::abort(c("Wrong initiative parameter input", "*" = paste0(initiative, "is not an option"), "i" = "Parameter 'initiative' should be one of 'reach' or 'agora'")) - } - - if (discrete) { - ggplot2::discrete_scale("fill", paste0(initiative, "_", palette), palette = pal, ...) - } else { - ggplot2::scale_fill_gradientn(colours = pal(256), ...) - } -} +#' Color scale constructor for REACH or AGORA colors +#' +#' @param initiative Either "reach" or "agora" or "default". +#' @param palette Palette name from `pal_reach()` or `pal_agora()`. +#' @param discrete Boolean indicating whether color aesthetic is discrete or not. +#' @param reverse Boolean indicating whether the palette should be reversed. +#' @param reverse_guide Boolean indicating whether the guide should be reversed. +#' @param ... Additional arguments passed to discrete_scale() or +#' scale_fill_gradient(), used respectively when discrete is TRUE or FALSE. +#' +#' @return A color scale for ggplot +#' +#' @export +scale_color <- function(initiative = "reach", palette = "main", discrete = TRUE, reverse = FALSE, reverse_guide = TRUE, ...) { + + if (initiative == "reach") { + + pal <- pal_reach(palette) + + if (is.null(pal)) { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + rlang::warn( + c( + paste0("There is no palette '", palette, "' for the selected initiative. Fallback to pal_fallback()."), + "i" = paste0("Use `pal_reach(show_palettes = TRUE)` to see the list of available palettes.") + ) + ) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + + pal <- pal_reach( + palette = palette, + reverse = reverse, + color_ramp_palette = TRUE, + show_palettes = FALSE + ) + + } + + } else if (initiative == "agora") { + + pal <- pal_agora(palette) + + if (is.null(pal)) { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + rlang::warn( + c( + paste0("There is no palette '", palette, "' for the selected initiative. Fallback to pal_fallback()."), + "i" = paste0("Use `pal_reach(show_palettes = TRUE)` to see the list of available palettes.") + ) + ) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + + pal <- pal_agora( + palette = palette, + reverse = reverse, + color_ramp_palette = TRUE, + show_palettes = FALSE + ) + } + + } else if (initiative == "default") { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + rlang::abort( + c( + paste0("There is no initiative '", initiative, "."), + "i" = paste0("initiative should be either 'reach', 'agora' or 'default'") + ) + ) + } + + if (discrete) { + ggplot2::discrete_scale( + "colour", + paste0(initiative, "_", palette), + palette = pal, + guide = ggplot2::guide_legend( + title.position = "top", + draw.ulim = TRUE, + draw.llim = TRUE, + ticks.colour = "#F1F3F5", + reverse = reverse_guide + ), + ... + ) + } else { + ggplot2::scale_color_gradientn( + colours = pal(256), + guide = ggplot2::guide_colorbar( + title.position = "top", + draw.ulim = TRUE, + draw.llim = TRUE, + ticks.colour = "#F1F3F5", + reverse = reverse_guide + ), + ... + ) + } +} + + + +#' Fill scale constructor for REACH or AGORA colors +#' +#' @param initiative Either "reach" or "agora" or "default". +#' @param palette Palette name from `pal_reach()` or `pal_agora()`. +#' @param discrete Boolean indicating whether color aesthetic is discrete or not. +#' @param reverse Boolean indicating whether the palette should be reversed. +#' @param reverse_guide Boolean indicating whether the guide should be reversed. +#' @param ... Additional arguments passed to discrete_scale() or +#' scale_fill_gradient(), used respectively when discrete is TRUE or FALSE. +#' +#' @return A fill scale for ggplot. +#' +#' @export +scale_fill <- function(initiative = "reach", palette = "main", discrete = TRUE, reverse = FALSE, reverse_guide = TRUE, ...) { + + + if (initiative == "reach") { + + pal <- pal_reach(palette) + + if (is.null(pal)) { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + rlang::warn( + c( + paste0("There is no palette '", palette, "' for the selected initiative. Fallback to pal_fallback()."), + "i" = paste0("Use `pal_reach(show_palettes = TRUE)` to see the list of available palettes.") + ) + ) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + + pal <- pal_reach( + palette = palette, + reverse = reverse, + color_ramp_palette = TRUE, + show_palettes = FALSE + ) + + } + + } else if (initiative == "agora") { + + pal <- pal_agora(palette) + + if (is.null(pal)) { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + rlang::warn( + c( + paste0("There is no palette '", palette, "' for the selected initiative. Fallback to pal_fallback()."), + "i" = paste0("Use `pal_reach(show_palettes = TRUE)` to see the list of available palettes.") + ) + ) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + + pal <- pal_agora( + palette = palette, + reverse = reverse, + color_ramp_palette = TRUE, + show_palettes = FALSE + ) + } + + } else if (initiative == "default") { + + pal <- pal_fallback( + reverse = reverse, + discrete = discrete, + color_ramp_palette = TRUE) + + if (discrete) palette <- "viridis" else palette <- "magma" + + } else { + rlang::abort( + c( + paste0("There is no initiative '", initiative, "."), + "i" = paste0("initiative should be either 'reach', 'agora' or 'default'") + ) + ) + } + + if (discrete) { + ggplot2::discrete_scale( + "fill", + paste0(initiative, "_", palette), + palette = pal, + guide = ggplot2::guide_legend( + title.position = "top", + draw.ulim = TRUE, + draw.llim = TRUE, + ticks.colour = "#F1F3F5", + reverse = reverse_guide + ), + ... + ) + } else { + ggplot2::scale_color_gradientn( + colours = pal(256), + guide = ggplot2::guide_colorbar( + title.position = "top", + draw.ulim = TRUE, + draw.llim = TRUE, + ticks.colour = "#F1F3F5", + reverse = reverse_guide + ), + ... + ) + } +} diff --git a/R/theme_reach.R b/R/theme_reach.R index c64caf2..ac4a3be 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -1,91 +1,290 @@ -#' @title Base REACH ggplot2 theme -#' -#' @param family The font family. Default to "Leelawadee" -#' -#' @description Give some reach colors and fonts to a ggplot. Based on theme_bw() -#' -#' @return The base REACH theme -#' -theme_reach <- function(family = "Leelawadee") { - - rlang::check_installed("ggplot2", reason = "Package \"ggplot2\" needed for `theme_reach_*()` to work. Please install it.") - - ggplot2::theme_bw() + - ggplot2::theme( - title = ggplot2::element_text(family = family, - size = 12, - colour = "#58585A", - hjust = 0.5, - vjust = 0.5), - text = ggplot2::element_text(family = family, - colour = "#58585A"), - axis.title = ggplot2::element_text(size = 11), - axis.text = ggplot2::element_text(size = 10), - legend.text = ggplot2::element_text(size = 11), - strip.text = ggplot2::element_text(size = 11), - legend.title = ggplot2::element_text(size = 11) - ) -} - - - -#' @title Some REACH theme for ggplot -#' -#' @param family The font family. Default to "Leelawadee" -#' -#' @return A theme to be added to the "+" ggplot grammar -#' -#' @export -theme_reach_borders <- function(family = "Leelawadee") { - - theme_reach() + - ggplot2::theme( - panel.background = ggplot2::element_rect(colour = "white", fill = "white", size = 0.5), - strip.background = ggplot2::element_rect(linetype = "solid", colour = "#58585A", fill = "white") - ) -} - - - -#' @title Some reach more minimal theme for ggplot -#' -#' @param family The font family. Default to "Leelawadee" -#' -#' @description Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for vertical bar charts. -#' -#' @return A theme to be added to the "+" ggplot grammar -#' -#' @export -theme_reach_hist <- function(family = "Leelawadee") { - - theme_reach() + - ggplot2::theme( - panel.background = ggplot2::element_blank(), - strip.background = ggplot2::element_blank(), - panel.border = ggplot2::element_blank() - ) -} - - -#' @title Some reach more minimal theme for ggplot -#' -#' @param family The font family. Default to "Leelawadee" -#' -#' @description Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for horizontal bar charts. -#' -#' @return A theme to be added to the "+" ggplot grammar -#' -#' @export -theme_reach_flip_hist <- function(family = "Leelawadee") { - - theme_reach() + - ggplot2::theme( - panel.background = ggplot2::element_blank(), - strip.background = ggplot2::element_blank(), - panel.border = ggplot2::element_blank(), - axis.ticks.y = ggplot2::element_blank() - ) -} - - - +#' @title ggplot2 theme with REACH color palettes +#' +#' @param initiative Either "reach" or "default". +#' @param palette Palette name from 'pal_reach()'. +#' @param discrete Boolean indicating whether color aesthetic is discrete or not. +#' @param reverse Boolean indicating whether the palette should be reversed. +#' @param font_family The font family for all plot's texts. Default to "Segoe UI". +#' @param title_size The size of the title. Defaults to 12. +#' @param title_color Title color. +#' @param title_font_face Title font face. Default to "bold". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param title_hjust Title horizontal justification. Default to NULL. Use 0.5 to center the title. +#' @param text_size The size of all text other than the title, subtitle and caption. Defaults to 10. +#' @param text_color Text color. +#' @param text_font_face Text font face. Default to "bold". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param panel_background_color The color for the panel background color. Default to white. +#' @param panel_border Boolean. Plot a panel border? Default to FALSE. +#' @param panel_border_color A color. Default to REACH main grey. +#' @param legend_position Position of the legend; Default to "right". Can take "right", "left", "top", "bottom" or "none". +#' @param legend_direction Direction of the legend. Default to "vertical". Can take "vertical" or "horizontal". +#' @param legend_title_size Legend title size. +#' @param legend_title_color Legend title color. +#' @param legend_title_font_face Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param legend_text_size Legend text size. +#' @param legend_text_color Legend text color. +#' @param legend_text_font_face Legend text font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param legend_reverse Reverse the color in the guide? Default to TRUE. +#' @param title_size The size of the legend title. Defaults to 11. +#' @param title_color Legend title color. +#' @param title_font_face Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param title_position_to_plot TRUE or FALSE. Positioning to plot or to panel? +#' @param axis_x Boolean. Do you need x-axis? +#' @param axis_y Boolean. Do you need y-axis? +#' @param axis_text_size Axis text size. +#' @param axis_text_color Axis text color. +#' @param axis_text_font_face Axis text font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param axis_text_x_angle Angle for the x-axis text. +#' @param axis_text_x_vjust Vertical adjustment for the x-axis text. +#' @param axis_text_x_hjust Vertical adjustment for the x-axis text. +#' @param axis_title_size Axis title size. +#' @param axis_title_color Axis title color. +#' @param axis_title_font_face Axis title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @param grid_major_x Boolean. Do you need major grid lines for x-axis? +#' @param grid_major_y Boolean. Do you need major grid lines for y-axis? +#' @param grid_major_x_size Major X line size. +#' @param grid_major_y_size Major Y line size. +#' @param grid_major_color Major grid lines color. +#' @param grid_minor_x Boolean. Do you need minor grid lines for x-axis? +#' @param grid_minor_y Boolean. Do you need minor grid lines for y-axis? +#' @param grid_minor_x_size Minor X line size. +#' @param grid_minor_y_size Minor Y line size. +#' @param grid_minor_color Minor grid lines color. +#' @param caption_position_to_plot TRUE or FALSE. Positioning to plot or to panel? +#' @param ... Additional arguments passed to `ggplot2::gg_theme()`. +#' +#' +#' @description Give some reach colors and fonts to a ggplot. +#' +#' @return The base REACH theme +#' +#' @export +theme_reach <- function( + initiative = "reach", + palette = "main", + discrete = TRUE, + reverse = FALSE, + font_family = "Segoe UI", + title_size = 12, + title_color = cols_reach("main_grey"), + title_font_face = "bold", + title_hjust = NULL, + title_position_to_plot = TRUE, + text_size = 10, + text_color = cols_reach("main_grey"), + text_font_face = "plain", + panel_background_color = "#FFFFFF", + panel_border = FALSE, + panel_border_color = cols_reach("main_grey"), + legend_position = "right", + legend_direction = "vertical", + legend_reverse = TRUE, + legend_title_size = 11, + legend_title_color = cols_reach("main_grey"), + legend_title_font_face = "plain", + legend_text_size = 10, + legend_text_color = cols_reach("main_grey"), + legend_text_font_face = "plain", + axis_x = TRUE, + axis_y = TRUE, + axis_text_size = 10, + axis_text_color = cols_reach("main_grey"), + axis_text_font_face = "plain", + axis_title_size = 11, + axis_title_color = cols_reach("main_grey"), + axis_title_font_face = "bold", + axis_text_x_angle = 0, + axis_text_x_vjust = 0.5, + axis_text_x_hjust = 0.5, + grid_major_x = FALSE, + grid_major_y = FALSE, + grid_major_color = cols_reach("main_lt_grey"), + grid_major_x_size = 0.1, + grid_major_y_size = 0.1, + grid_minor_x = FALSE, + grid_minor_y = FALSE, + grid_minor_color = cols_reach("main_lt_grey"), + grid_minor_x_size = 0.05, + grid_minor_y_size = 0.05, + caption_position_to_plot = TRUE, + ... + ) { + + # To do : + # - add facet theming + + if (!initiative %in% c("reach", "default")) + rlang::abort( + c( + paste0("There is no initiative '", initiative, " to be used with theme_reach()."), + "i" = paste0("initiative should be either 'reach' or 'default'") + ) + ) + + # Basic simple theme + # theme_reach <- ggplot2::theme_bw() + + theme_reach <- ggplot2::theme( + # Title - design + title = ggplot2::element_text( + family = font_family, + color = title_color, + size = title_size, + face = title_font_face + ), + # Text - design + text = ggplot2::element_text( + family = font_family, + color = text_color, + size = text_size, + face = text_font_face + ), + # Default legend to right position + legend.position = legend_position, + # Defaut legend to vertical direction + legend.direction = legend_direction, + # set panel background color + panel.background = ggplot2::element_rect( + fill = panel_background_color + ), + # Remove background for legend key + legend.key = ggplot2::element_blank(), + # Text sizes + axis.text = ggplot2::element_text( + size = axis_text_size, + family = font_family, + face = axis_text_font_face, + color = axis_text_color + ), + axis.title = ggplot2::element_text( + size = axis_title_size, + family = font_family, + face = axis_title_font_face, + color = axis_title_color), + # Wrap title + plot.title = ggtext::element_textbox( + hjust = title_hjust + ), + plot.subtitle = ggtext::element_textbox( + hjust = title_hjust + ), + plot.caption = ggtext::element_textbox(), + legend.title = ggplot2::element_text( + size = legend_title_size, + face = legend_title_font_face, + family = font_family, + color = legend_title_color), + legend.text = ggplot2::element_text( + size = legend_text_size, + face = legend_text_font_face, + family = font_family, + color = legend_text_color + ), + axis.text.x = ggplot2::element_text( + angle = axis_text_x_angle, + vjust = axis_text_x_vjust, + hjust = axis_text_x_hjust + ) + ) + + # Position of title + if (title_position_to_plot) theme_reach <- theme_reach + + ggplot2::theme( + plot.title.position = "plot" + ) + + if (caption_position_to_plot) theme_reach <- theme_reach + + ggplot2::theme( + plot.caption.position = "plot" + ) + # Position of caption + + # Axis lines ? + if (axis_x & axis_y) { + theme_reach <- theme_reach + + ggplot2::theme( + axis.line = ggplot2::element_line(color = text_color)) + } + + if (!axis_x) { + theme_reach <- theme_reach + + ggplot2::theme( + axis.line.x = ggplot2::element_blank(), + axis.ticks.x = ggplot2::element_blank(), + axis.text.x = ggplot2::element_blank()) + } + + if (!axis_y) { + theme_reach <- theme_reach + + ggplot2::theme( + axis.line.y = ggplot2::element_blank(), + axis.ticks.y = ggplot2::element_blank(), + axis.text.y = ggplot2::element_blank()) + } + + # X - major grid lines + if (!grid_major_x) theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.major.x = ggplot2::element_blank() + ) else theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.major.x = ggplot2::element_line( + color = grid_major_color, + linewidth = grid_major_x_size) + ) + + # Y - major grid lines + if (!grid_major_y) theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.major.y = ggplot2::element_blank() + ) else theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.major.y = ggplot2::element_line( + color = grid_major_color, + linewidth = grid_major_y_size) + ) + + # X - minor grid lines + if (!grid_minor_x) theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.minor.x = ggplot2::element_blank() + ) else theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.minor.x = ggplot2::element_line( + color = grid_minor_color, + linewidth = grid_minor_x_size) + ) + + # Y - minor grid lines + if (!grid_minor_y) theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.minor.y = ggplot2::element_blank() + ) else theme_reach <- theme_reach + + ggplot2::theme( + panel.grid.minor.y = ggplot2::element_line( + color = grid_minor_color, + linewidth = grid_minor_y_size) + ) + if (!panel_border) theme_reach <- theme_reach + + ggplot2::theme( + panel.border = ggplot2::element_blank() + ) else theme_reach <- theme_reach + + ggplot2::theme( + panel.border = ggplot2::element_rect(color = panel_background_color) + ) + + + # Other parameters + theme_reach <- theme_reach + ggplot2::theme(...) + + # Add reach color palettes by default + # (reversed guide is defaulted to TRUE for natural reading) + theme_reach <- list( + theme_reach, + scale_color(initiative = initiative, palette = palette, discrete = discrete, reverse = reverse, reverse_guide = legend_reverse), + scale_fill(initiative = initiative, palette = palette, discrete = discrete, reverse = reverse, reverse_guide = legend_reverse) + ) + + + return(theme_reach) + +} diff --git a/R/visualizeR-package.R b/R/visualizeR-package.R new file mode 100644 index 0000000..62800aa --- /dev/null +++ b/R/visualizeR-package.R @@ -0,0 +1,7 @@ +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start +#' @importFrom rlang := +## usethis namespace: end +NULL diff --git a/R/waffle.R b/R/waffle.R new file mode 100644 index 0000000..7df06d9 --- /dev/null +++ b/R/waffle.R @@ -0,0 +1,74 @@ +#' @title Simple waffle chart +#' +#' @param df A data frame. +#' @param x A character column or coercible as a character column. Will give the waffle's fill color. +#' @param y A numeric column (if plotting proportion, make sure to have percentages between 0 and 100 and not 0 and 1). +#' @param n_rows Number of rows. Default to 10. +#' @param size Width of the separator between blocks (defaults to 2). +#' @param x_title The x scale title. Default to NULL. +#' @param x_lab The x scale caption. Default to NULL. +#' @param title Plot title. Default to NULL. +#' @param subtitle Plot subtitle. Default to NULL. +#' @param caption Plot caption. Default to NULL. +#' @param arrange TRUE or FALSE. Arrange by highest percentage first. +#' @param theme Whatever theme. Default to theme_reach(). +#' +#' @return A waffle chart +#' +#' @export +waffle <- function(df, + x, + y, + n_rows = 10, + size = 2, + x_title = NULL, + x_lab = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + arrange = TRUE, + theme = theme_reach( + axis_x = FALSE, + axis_y = FALSE, + legend_position = "bottom", + legend_direction = "horizontal", + title_hjust = 0.5)){ + + # A basic and not robust check + # - add check between 0 and 1 + + # Arrange by biggest prop first ? + if (arrange) df <- dplyr::arrange( + df, + dplyr::desc({{ y }}) + ) + + # Mutate to 100 + # df <- dplyr::mutate(df, "{{y}}" := {{ y }} * 100) + + # Prepare named vector + values <- stats::setNames(dplyr::pull(df, {{ y }}), dplyr::pull(df, {{ x }})) + + # Make plot + g <- waffle::waffle(values, xlab = x_lab, rows = n_rows, size = size) + + # Add title, subtitle, caption, x_title, y_title + g <- g + ggplot2::labs( + title = title, + subtitle = subtitle, + caption = caption, + fill = x_title, + color = x_title + ) + + # Basic theme + # g <- g + + # hrbrthemes::theme_ipsum() #+ + # waffle::theme_enhance_waffle() + + # Add theme + g <- g + theme + + return(g) + +} diff --git a/README.Rmd b/README.Rmd index 52638b5..df843f4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,58 +1,294 @@ ---- -output: github_document ---- - - - -```{r, include = FALSE} -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>", - fig.path = "man/figures/README-", - out.width = "100%" -) - -desc = read.dcf('DESCRIPTION') -desc = setNames(as.list(desc), colnames(desc)) -``` - - -# `r desc$Package` - -> `r desc$Title` - -`visualizeR` proposes some utils to get REACH and AGORA colors, ready-to-go color palettes, and a few visualization functions (horizontal hist graph for instance). - -## Installation - -You can install the last version of visualizeR from -[GitHub](https://github.com/) with: - -```{r, eval = FALSE} -# install.packages("devtools") -devtools::install_github("gnoblet/visualizeR", build_vignettes = TRUE) -``` - -## Roadmap - -Roadmap is as follows: - -- [ ] Add IMPACT's colors -- [ ] Add all color palettes from the internal documentation -- [ ] Add new types of visualization (e.g. dumbbell plot) -- [ ] Use examples -- [ ] Add some ease-map functions -- [ ] Add some interactive functions (maps and graphs) - -## Request - -Please, do not hesitate to pull request any new viz or colors or color palettes, or to email request any change (guillaume.noblet@reach-initiative.org or gnoblet@zaclys.net). - - -## Example - -```{r example, eval = FALSE} -library(visualizeR) -# Get all saved REACH colors, named -cols_reach(unnamed = F) -``` +--- +output: github_document +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%", + warning = FALSE, + message = FALSE, + dpi = 300, + dev.args = list(type = "cairo") +) + +desc = read.dcf('DESCRIPTION') +desc = setNames(as.list(desc), colnames(desc)) +``` + +# `r desc$Package` + +> `r desc$Title` + +`visualizeR` proposes some utils to get REACH and AGORA colors, ready-to-go color palettes, and a few visualization functions (horizontal hist graph for instance). + +## Installation + +You can install the last version of visualizeR from +[GitHub](https://github.com/) with: + +```{r, eval = FALSE} +# install.packages("devtools") +devtools::install_github("gnoblet/visualizeR", build_vignettes = TRUE) +``` + +## Roadmap + +Roadmap is as follows: + +- [X] Add IMPACT's colors +- [X] Add all color palettes from the internal documentation +- [ ] There remains to be added more-than-7-color palettes and black color palettes +- [X] Add new types of visualization (e.g. dumbbell plot, lollipop plot, etc.) +- [X] Use examples +- [ ] Add some ease-map functions +- [ ] Add some interactive functions (maps and graphs) +- [ ] Consolidate and make errors transparent + +## Request + +Please, do not hesitate to pull request any new viz or colors or color palettes, or to email request any change (guillaume.noblet@reach-initiative.org or gnoblet@zaclys.net). + +## Colors + +Color palettes for REACH, AGORA and IMPACT are available. Functions to access colors and palettes are `cols_initiative()` or `pal_initiative()`. For now, the initiative with the most colors and color palettes is REACH. Feel free to pull requests new AGORA and IMPACT colors. + +```{r example-colors, eval = TRUE} +library(visualizeR) + +# Get all saved REACH colors, named +cols_reach(unnamed = F)[1:10] + +# Extract a color palette as hexadecimal codes and reversed +pal_reach(palette = "main", reversed = TRUE, color_ramp_palette = FALSE) + +# Get all color palettes names +pal_reach(show_palettes = T) +``` + +## Charts + +### Example 1: Bar chart, already REACH themed + +```{r example-bar-chart, out.width = "65%", eval = TRUE} +library(visualizeR) +library(palmerpenguins) +library(dplyr) + +df <- penguins |> + group_by(island, species) |> + summarize( + mean_bl = mean(bill_length_mm, na.rm = T), + mean_fl = mean(flipper_length_mm, na.rm = T)) |> + ungroup() + +# Simple bar chart by group with some alpha transparency +bar(df, island, mean_bl, species, percent = FALSE, alpha = 0.6, x_title = "Mean of bill length") + +# Using another color palette through `theme_reach()` and changing scale to percent +bar(df, island,mean_bl, species, percent = TRUE, theme = theme_reach(palette = "artichoke_3")) + +# Not flipped, with text added, group_title, no y-axis and no bold for legend +bar(df, island, mean_bl, species, group_title = "Species", flip = FALSE, add_text = TRUE, add_text_suffix = "%", percent = FALSE, theme = theme_reach(text_font_face = "plain", axis_y = FALSE)) + +``` + +### Example 2: Point chart, already REACH themed + +At this stage, `point_reach()` only supports categorical grouping colors with the `group` arg. + +```{r example-point-chart, out.width = "65%", eval = TRUE} + +# Simple point chart +point(penguins, bill_length_mm, flipper_length_mm) + +# Point chart with grouping colors, greater dot size, some transparency, reversed color palette +point(penguins, bill_length_mm, flipper_length_mm, island, alpha = 0.6, size = 3, theme = theme_reach(reverse = TRUE)) + +# Using another color palettes +point(penguins, bill_length_mm, flipper_length_mm, island, size = 1.5, x_title = "Bill", y_title = "Flipper", title = "Length (mm)", theme = theme_reach(palette = "artichoke_3", text_font_face = , grid_major_x = TRUE, title_position_to_plot = FALSE)) +``` + + +### Example 3: Dumbbell plot, REACH themed + +Remember to ensure that your data are in the long format and you only have two groups on the x-axis; for instance, IDP and returnee and no NA values. + +```{r example-dumbbell-plot, out.width = "65%", eval = TRUE} +# Prepare long data +df <- tibble::tibble( + admin1 = rep(letters[1:8], 2), + setting = c(rep(c("Rural", "Urban"), 4), rep(c("Urban", "Rural"), 4)), + stat = rnorm(16, mean = 50, sd = 18) +) |> + dplyr::mutate(stat = round(stat, 0)) + +# Example, adding a parameter to `theme_reach()` passed on `ggplot2::theme()` to align legend title + +dumbbell(df, + stat, + setting, + admin1, + title = "% of HHs that reported open defecation as sanitation facility", + group_y_title = "Admin 1", + group_x_title = "Setting", + theme = theme_reach(legend_position = "bottom", + legend_direction = "horizontal", + legend_title_font_face = "bold", + palette = "primary", + title_position_to_plot = FALSE, + legend.title.align = 0.5)) + + # Change legend title position (could be included as part of the function) + ggplot2::guides( + color = ggplot2::guide_legend(title.position = "left"), + fill = ggplot2::guide_legend(title.position = "left") + ) +``` + +### Example 4: donut chart, REACH themed (to used once, not twice) +```{r example-donut-plot, out.width = "65%", warning = FALSE} + +# Some summarized data: % of HHs by displacement status +df <- tibble::tibble( + status = c("Displaced", "Non displaced", "Returnee", "Don't know/Prefer not to say"), + percentage = c(18, 65, 12, 3) +) + +# Donut +donut(df, + status, + percentage, + hole_size = 3, + add_text_suffix = "%", + add_text_color = cols_reach("dk_grey"), + add_text_treshold_display = 5, + x_title = "Displacement status", + title = "% of HHs by displacement status", + theme = theme_reach(legend_reverse = TRUE)) +``` + + +### Example 5: waffle chart +```{r example-waffle-plot, out.width = "65%", warning = FALSE} +# +waffle(df, status, percentage, x_title = "A caption", title = "A title", subtitle = "A subtitle") +``` + + +### Example 6: alluvial chart, REACH themed +```{r example-alluvial-plot, out.width = "65%", warning = FALSE} + +# Some summarized data: % of HHs by self-reported status of displacement in 2021 and in 2022 +df <- tibble::tibble( + status_from = c(rep("Displaced", 4), + rep("Non displaced", 4), + rep("Returnee", 4), + rep("Dnk/Pnts", 4)), + status_to = c("Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts"), + percentage = c(20, 8, 18, 1, 12, 21, 0, 2, 0, 3, 12, 1, 0, 0, 1, 1) +) + +# Alluvial, here the group is the status for 2021 + +alluvial(df, + status_from, + status_to, + percentage, + status_from, + from_levels = c("Displaced", "Non displaced", "Returnee", "Dnk/Pnts"), + alpha = 0.8, + group_title = "Status for 2021", + title = "% of HHs by self-reported status from 2021 to 2022", + theme = theme_reach( + axis_y = FALSE, + legend_position = "none")) + +``` + +### Example 7: lollipop chart +```{r example-lollipop-chart, out.width = "65%", warning = FALSE} +library(tidyr) +# Prepare long data +df <- tibble::tibble( + admin1 = replicate(15, sample(letters, 8)) |> t() |> as.data.frame() |> unite("admin1", sep = "") |> dplyr::pull(admin1), + stat = rnorm(15, mean = 50, sd = 15)) |> + dplyr::mutate(stat = round(stat, 0)) + +# Make lollipop plot, REACH themed, vertical with 45 degrees angle X-labels +lollipop(df, + admin1, + stat, + arrange = FALSE, + add_text = FALSE, + flip = FALSE, + y_title = "% of HHs", + x_title = "Admin 1", + title = "% of HHs that reported having received a humanitarian assistance", + theme = theme_reach(axis_text_x_angle = 45, + grid_major_y = TRUE, + grid_major_y_size = 0.2, + grid_major_x = TRUE, + grid_minor_y = TRUE)) + +# Horizontal, greater point size, arranged by value, no grid, and text labels added +lollipop(df, + admin1, + stat, + arrange = TRUE, + point_size = 10, + point_color = cols_reach("main_beige"), + segment_size = 2, + add_text = TRUE, + add_text_suffix = "%", + y_title = "% of HHs", + x_title = "Admin 1", + title = "% of HHs that reported having received a humanitarian assistance in the 12 months prior to the assessment", + theme = theme_reach(title_position_to_plot = FALSE)) + + +``` + + +## Maps + +```{r example-map, out.width = "50%"} + +# Add indicator layer +# - based on "pretty" classes and title "Proportion (%)" +# - buffer to add a 10% around the bounding box +map <- add_indicator_layer( + indicator_admin1, + opn_dfc, + buffer = 0.1) + + # Layout - some defaults - add the map title + add_layout("% of HH that reported open defecation as sanitation facility") + + # Admin boundaries as list of shape files (lines) and colors, line widths and labels as vectors + add_admin_boundaries( + lines = list(line_admin1, border_admin0, frontier_admin0), + colors = cols_reach("main_lt_grey", "dk_grey", "black"), + lwds = c(0.5, 2, 3), + labels = c("Department", "Country", "Dominican Rep. frontier"), + title = "Administrative boundaries") + + # Add text labels - centered on admin 1 centroids + add_admin_labels(centroid_admin1, ADM1_FR_UPPER) + + # Add a compass + add_compass() + + # Add a scale bar + add_scale_bar() + + # Add credits + add_credits("Admin. boundaries. : CNIGS \nCoord. system: GCS WGS 1984") +``` + +```{r map-save, eval = TRUE, include = FALSE, echo = TRUE} +tmap::tmap_save(map, + "man/figures/README-example-map.png", + height = 4.5, + width = 6 + ) +``` + +![Once exported with `tmap::tmap_save()`.](man/figures/README-example-map.png) diff --git a/README.md b/README.md index f1cc152..0e24eb5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # visualizeR -> What a color! What a viz! +> What a color\! What a viz\! `visualizeR` proposes some utils to get REACH and AGORA colors, ready-to-go color palettes, and a few visualization functions @@ -23,12 +23,16 @@ devtools::install_github("gnoblet/visualizeR", build_vignettes = TRUE) Roadmap is as follows: -- [ ] Add IMPACT’s colors -- [ ] Add all color palettes from the internal documentation -- [ ] Add new types of visualization (e.g. dumbbell plot) -- [ ] Use examples -- [ ] Add some ease-map functions -- [ ] Add some interactive functions (maps and graphs) + - \[X\] Add IMPACT’s colors + - \[X\] Add all color palettes from the internal documentation + - \[ \] There remains to be added more-than-7-color palettes and black + color palettes + - \[X\] Add new types of visualization (e.g. dumbbell plot, lollipop + plot, etc.) + - \[X\] Use examples + - \[ \] Add some ease-map functions + - \[ \] Add some interactive functions (maps and graphs) + - \[ \] Consolidate and make errors transparent ## Request @@ -36,10 +40,291 @@ Please, do not hesitate to pull request any new viz or colors or color palettes, or to email request any change ( or ). -## Example +## Colors + +Color palettes for REACH, AGORA and IMPACT are available. Functions to +access colors and palettes are `cols_initiative()` or +`pal_initiative()`. For now, the initiative with the most colors and +color palettes is REACH. Feel free to pull requests new AGORA and IMPACT +colors. ``` r library(visualizeR) + # Get all saved REACH colors, named -cols_reach(unnamed = F) +cols_reach(unnamed = F)[1:10] +#> white black main_grey main_red main_lt_grey main_beige +#> "#FFFFFF" "#000000" "#58585A" "#EE5859" "#C7C8CA" "#D2CBB8" +#> iroise_1 iroise_2 iroise_3 iroise_4 +#> "#DFECEF" "#B1D7E0" "#699DA3" "#236A7A" + +# Extract a color palette as hexadecimal codes and reversed +pal_reach(palette = "main", reversed = TRUE, color_ramp_palette = FALSE) +#> [1] "#58585A" "#EE5859" "#C7C8CA" "#D2CBB8" + +# Get all color palettes names +pal_reach(show_palettes = T) +#> [1] "main" "primary" "secondary" "two_dots" +#> [5] "two_dots_flashy" "red_main" "red_main_5" "red_alt" +#> [9] "red_alt_5" "iroise" "iroise_5" "discrete_6" +#> [13] "red_2" "red_3" "red_4" "red_5" +#> [17] "red_6" "red_7" "green_2" "green_3" +#> [21] "green_4" "green_5" "green_6" "green_7" +#> [25] "artichoke_2" "artichoke_3" "artichoke_4" "artichoke_5" +#> [29] "artichoke_6" "artichoke_7" "blue_2" "blue_3" +#> [33] "blue_4" "blue_5" "blue_6" "blue_7" ``` + +## Charts + +### Example 1: Bar chart, already REACH themed + +``` r +library(visualizeR) +library(palmerpenguins) +library(dplyr) + +df <- penguins |> + group_by(island, species) |> + summarize( + mean_bl = mean(bill_length_mm, na.rm = T), + mean_fl = mean(flipper_length_mm, na.rm = T)) |> + ungroup() + +# Simple bar chart by group with some alpha transparency +bar(df, island, mean_bl, species, percent = FALSE, alpha = 0.6, x_title = "Mean of bill length") +``` + + + +``` r + +# Using another color palette through `theme_reach()` and changing scale to percent +bar(df, island,mean_bl, species, percent = TRUE, theme = theme_reach(palette = "artichoke_3")) +``` + + + +``` r + +# Not flipped, with text added, group_title, no y-axis and no bold for legend +bar(df, island, mean_bl, species, group_title = "Species", flip = FALSE, add_text = TRUE, add_text_suffix = "%", percent = FALSE, theme = theme_reach(text_font_face = "plain", axis_y = FALSE)) +``` + + + +### Example 2: Point chart, already REACH themed + +At this stage, `point_reach()` only supports categorical grouping colors +with the `group` arg. + +``` r + +# Simple point chart +point(penguins, bill_length_mm, flipper_length_mm) +``` + + + +``` r + +# Point chart with grouping colors, greater dot size, some transparency, reversed color palette +point(penguins, bill_length_mm, flipper_length_mm, island, alpha = 0.6, size = 3, theme = theme_reach(reverse = TRUE)) +``` + + + +``` r + +# Using another color palettes +point(penguins, bill_length_mm, flipper_length_mm, island, size = 1.5, x_title = "Bill", y_title = "Flipper", title = "Length (mm)", theme = theme_reach(palette = "artichoke_3", text_font_face = , grid_major_x = TRUE, title_position_to_plot = FALSE)) +``` + + + +### Example 3: Dumbbell plot, REACH themed + +Remember to ensure that your data are in the long format and you only +have two groups on the x-axis; for instance, IDP and returnee and no NA +values. + +``` r +# Prepare long data +df <- tibble::tibble( + admin1 = rep(letters[1:8], 2), + setting = c(rep(c("Rural", "Urban"), 4), rep(c("Urban", "Rural"), 4)), + stat = rnorm(16, mean = 50, sd = 18) +) |> + dplyr::mutate(stat = round(stat, 0)) + +# Example, adding a parameter to `theme_reach()` passed on `ggplot2::theme()` to align legend title + +dumbbell(df, + stat, + setting, + admin1, + title = "% of HHs that reported open defecation as sanitation facility", + group_y_title = "Admin 1", + group_x_title = "Setting", + theme = theme_reach(legend_position = "bottom", + legend_direction = "horizontal", + legend_title_font_face = "bold", + palette = "primary", + title_position_to_plot = FALSE, + legend.title.align = 0.5)) + + # Change legend title position (could be included as part of the function) + ggplot2::guides( + color = ggplot2::guide_legend(title.position = "left"), + fill = ggplot2::guide_legend(title.position = "left") + ) +``` + + + +### Example 4: donut chart, REACH themed (to used once, not twice) + +``` r + +# Some summarized data: % of HHs by displacement status +df <- tibble::tibble( + status = c("Displaced", "Non displaced", "Returnee", "Don't know/Prefer not to say"), + percentage = c(18, 65, 12, 3) +) + +# Donut +donut(df, + status, + percentage, + hole_size = 3, + add_text_suffix = "%", + add_text_color = cols_reach("dk_grey"), + add_text_treshold_display = 5, + x_title = "Displacement status", + title = "% of HHs by displacement status", + theme = theme_reach(legend_reverse = TRUE)) +``` + + + +### Example 5: waffle chart + +``` r +# +waffle(df, status, percentage, x_title = "A caption", title = "A title", subtitle = "A subtitle") +``` + + + +### Example 6: alluvial chart, REACH themed + +``` r + +# Some summarized data: % of HHs by self-reported status of displacement in 2021 and in 2022 +df <- tibble::tibble( + status_from = c(rep("Displaced", 4), + rep("Non displaced", 4), + rep("Returnee", 4), + rep("Dnk/Pnts", 4)), + status_to = c("Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts", "Displaced", "Non displaced", "Returnee", "Dnk/Pnts"), + percentage = c(20, 8, 18, 1, 12, 21, 0, 2, 0, 3, 12, 1, 0, 0, 1, 1) +) + +# Alluvial, here the group is the status for 2021 + +alluvial(df, + status_from, + status_to, + percentage, + status_from, + from_levels = c("Displaced", "Non displaced", "Returnee", "Dnk/Pnts"), + alpha = 0.8, + group_title = "Status for 2021", + title = "% of HHs by self-reported status from 2021 to 2022", + theme = theme_reach( + axis_y = FALSE, + legend_position = "none")) +``` + + + +### Example 7: lollipop chart + +``` r +library(tidyr) +# Prepare long data +df <- tibble::tibble( + admin1 = replicate(15, sample(letters, 8)) |> t() |> as.data.frame() |> unite("admin1", sep = "") |> dplyr::pull(admin1), + stat = rnorm(15, mean = 50, sd = 15)) |> + dplyr::mutate(stat = round(stat, 0)) + +# Make lollipop plot, REACH themed, vertical with 45 degrees angle X-labels +lollipop(df, + admin1, + stat, + arrange = FALSE, + add_text = FALSE, + flip = FALSE, + y_title = "% of HHs", + x_title = "Admin 1", + title = "% of HHs that reported having received a humanitarian assistance", + theme = theme_reach(axis_text_x_angle = 45, + grid_major_y = TRUE, + grid_major_y_size = 0.2, + grid_major_x = TRUE, + grid_minor_y = TRUE)) +``` + + + +``` r + +# Horizontal, greater point size, arranged by value, no grid, and text labels added +lollipop(df, + admin1, + stat, + arrange = TRUE, + point_size = 10, + point_color = cols_reach("main_beige"), + segment_size = 2, + add_text = TRUE, + add_text_suffix = "%", + y_title = "% of HHs", + x_title = "Admin 1", + title = "% of HHs that reported having received a humanitarian assistance in the 12 months prior to the assessment", + theme = theme_reach(title_position_to_plot = FALSE)) +``` + + + +## Maps + +``` r + +# Add indicator layer +# - based on "pretty" classes and title "Proportion (%)" +# - buffer to add a 10% around the bounding box +map <- add_indicator_layer( + indicator_admin1, + opn_dfc, + buffer = 0.1) + + # Layout - some defaults - add the map title + add_layout("% of HH that reported open defecation as sanitation facility") + + # Admin boundaries as list of shape files (lines) and colors, line widths and labels as vectors + add_admin_boundaries( + lines = list(line_admin1, border_admin0, frontier_admin0), + colors = cols_reach("main_lt_grey", "dk_grey", "black"), + lwds = c(0.5, 2, 3), + labels = c("Department", "Country", "Dominican Rep. frontier"), + title = "Administrative boundaries") + + # Add text labels - centered on admin 1 centroids + add_admin_labels(centroid_admin1, ADM1_FR_UPPER) + + # Add a compass + add_compass() + + # Add a scale bar + add_scale_bar() + + # Add credits + add_credits("Admin. boundaries. : CNIGS \nCoord. system: GCS WGS 1984") +``` + +![Once exported with +`tmap::tmap_save()`.](man/figures/README-example-map.png) diff --git a/data-raw/border_admin0.dbf b/data-raw/border_admin0.dbf new file mode 100644 index 0000000..2cdd77c Binary files /dev/null and b/data-raw/border_admin0.dbf differ diff --git a/data-raw/border_admin0.prj b/data-raw/border_admin0.prj new file mode 100644 index 0000000..f8e4548 --- /dev/null +++ b/data-raw/border_admin0.prj @@ -0,0 +1 @@ +PROJCS["WGS_1984_UTM_Zone_18N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-75.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["m",1.0]] \ No newline at end of file diff --git a/data-raw/border_admin0.shp b/data-raw/border_admin0.shp new file mode 100644 index 0000000..559c58d Binary files /dev/null and b/data-raw/border_admin0.shp differ diff --git a/data-raw/border_admin0.shx b/data-raw/border_admin0.shx new file mode 100644 index 0000000..f4d8240 Binary files /dev/null and b/data-raw/border_admin0.shx differ diff --git a/data-raw/centroid_admin1.dbf b/data-raw/centroid_admin1.dbf new file mode 100644 index 0000000..f17bfb9 Binary files /dev/null and b/data-raw/centroid_admin1.dbf differ diff --git a/data-raw/centroid_admin1.prj b/data-raw/centroid_admin1.prj new file mode 100644 index 0000000..79392c5 --- /dev/null +++ b/data-raw/centroid_admin1.prj @@ -0,0 +1 @@ +GEOGCS["GCS_unknown",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/data-raw/centroid_admin1.shp b/data-raw/centroid_admin1.shp new file mode 100644 index 0000000..67811d2 Binary files /dev/null and b/data-raw/centroid_admin1.shp differ diff --git a/data-raw/centroid_admin1.shx b/data-raw/centroid_admin1.shx new file mode 100644 index 0000000..f6ca9fc Binary files /dev/null and b/data-raw/centroid_admin1.shx differ diff --git a/data-raw/frontier_admin0.dbf b/data-raw/frontier_admin0.dbf new file mode 100644 index 0000000..20c39d2 Binary files /dev/null and b/data-raw/frontier_admin0.dbf differ diff --git a/data-raw/frontier_admin0.prj b/data-raw/frontier_admin0.prj new file mode 100644 index 0000000..f45cbad --- /dev/null +++ b/data-raw/frontier_admin0.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/data-raw/frontier_admin0.shp b/data-raw/frontier_admin0.shp new file mode 100644 index 0000000..6a7c832 Binary files /dev/null and b/data-raw/frontier_admin0.shp differ diff --git a/data-raw/frontier_admin0.shx b/data-raw/frontier_admin0.shx new file mode 100644 index 0000000..aeb62b0 Binary files /dev/null and b/data-raw/frontier_admin0.shx differ diff --git a/data-raw/indicator_admin1.dbf b/data-raw/indicator_admin1.dbf new file mode 100644 index 0000000..9dd16e2 Binary files /dev/null and b/data-raw/indicator_admin1.dbf differ diff --git a/data-raw/indicator_admin1.prj b/data-raw/indicator_admin1.prj new file mode 100644 index 0000000..f45cbad --- /dev/null +++ b/data-raw/indicator_admin1.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/data-raw/indicator_admin1.shp b/data-raw/indicator_admin1.shp new file mode 100644 index 0000000..cd956a4 Binary files /dev/null and b/data-raw/indicator_admin1.shp differ diff --git a/data-raw/indicator_admin1.shx b/data-raw/indicator_admin1.shx new file mode 100644 index 0000000..114b1d3 Binary files /dev/null and b/data-raw/indicator_admin1.shx differ diff --git a/data-raw/line_admin1.dbf b/data-raw/line_admin1.dbf new file mode 100644 index 0000000..27046d0 Binary files /dev/null and b/data-raw/line_admin1.dbf differ diff --git a/data-raw/line_admin1.prj b/data-raw/line_admin1.prj new file mode 100644 index 0000000..f45cbad --- /dev/null +++ b/data-raw/line_admin1.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/data-raw/line_admin1.shp b/data-raw/line_admin1.shp new file mode 100644 index 0000000..5a39a4b Binary files /dev/null and b/data-raw/line_admin1.shp differ diff --git a/data-raw/line_admin1.shx b/data-raw/line_admin1.shx new file mode 100644 index 0000000..e078d09 Binary files /dev/null and b/data-raw/line_admin1.shx differ diff --git a/data-raw/shapefiles.R b/data-raw/shapefiles.R new file mode 100644 index 0000000..13db57a --- /dev/null +++ b/data-raw/shapefiles.R @@ -0,0 +1,21 @@ + +#------ Border - admin 0 +border_admin0 <- sf::st_read("data-raw/border_admin0.shp") +usethis::use_data(border_admin0, overwrite = TRUE) + +#------ Frontier - admin 0 +frontier_admin0 <- sf::st_read("data-raw/frontier_admin0.shp") +usethis::use_data(frontier_admin0, overwrite = TRUE) + +#------ Line - admin 1 +line_admin1 <- sf::st_read("data-raw/line_admin1.shp") +usethis::use_data(line_admin1, overwrite = TRUE) + +#------ Centroid - admin 1 +centroid_admin1 <- sf::st_read("data-raw/centroid_admin1.shp") |> + dplyr::rename(ADM1_FR_UPPER = ADM1_FR_) +usethis::use_data(centroid_admin1, overwrite = TRUE) + +#------ Indicator polygon - admin 1 +indicator_admin1 <- sf::st_read("data-raw/indicator_admin1.shp") +usethis::use_data(indicator_admin1, overwrite = TRUE) diff --git a/data/border_admin0.rda b/data/border_admin0.rda new file mode 100644 index 0000000..a6400e1 Binary files /dev/null and b/data/border_admin0.rda differ diff --git a/data/centroid_admin1.rda b/data/centroid_admin1.rda new file mode 100644 index 0000000..f144be5 Binary files /dev/null and b/data/centroid_admin1.rda differ diff --git a/data/frontier_admin0.rda b/data/frontier_admin0.rda new file mode 100644 index 0000000..b57263a Binary files /dev/null and b/data/frontier_admin0.rda differ diff --git a/data/indicator_admin1.rda b/data/indicator_admin1.rda new file mode 100644 index 0000000..f1a1a63 Binary files /dev/null and b/data/indicator_admin1.rda differ diff --git a/data/line_admin1.rda b/data/line_admin1.rda new file mode 100644 index 0000000..9393fdd Binary files /dev/null and b/data/line_admin1.rda differ diff --git a/docs/404.html b/docs/404.html index bee377d..9c5ece6 100644 --- a/docs/404.html +++ b/docs/404.html @@ -13,10 +13,10 @@ - - + + - + GNU General Public License • visualizeRGNU General Public License • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Abord bad argument

+
+ +
+

Usage

+
abort_bad_argument(arg, must, not = NULL)
+
+ +
+

Arguments

+
arg
+

An argument

+ + +
must
+

What arg must be

+ + +
not
+

Optional. What arg must not be.

+ +
+
+

Value

+ + +

A stop statement

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_admin_boundaries.html b/docs/reference/add_admin_boundaries.html new file mode 100644 index 0000000..064b103 --- /dev/null +++ b/docs/reference/add_admin_boundaries.html @@ -0,0 +1,121 @@ + +Add admin boundaries (lines) and the legend — add_admin_boundaries • visualizeR + Skip to contents + + +
+
+
+ +
+

Add admin boundaries (lines) and the legend

+
+ +
+

Usage

+
add_admin_boundaries(
+  lines,
+  colors,
+  labels,
+  lwds,
+  title = "",
+  buffer = NULL,
+  ...
+)
+
+ +
+

Arguments

+
lines
+

List of multiline shape defined by sf package.

+ + +
colors
+

Vector of hexadecimal codes. Same order as lines.

+ + +
labels
+

Vector of labels in the legend. Same order as lines.

+ + +
lwds
+

Vector of line widths. Same order as lines.

+ + +
title
+

Legend title.

+ + +
buffer
+

A buffer, either one value or a vector of 4 values (left, bottom, right, top).

+ + +
...
+

Other arguments to pass to each shape in `tmap::tm_lines()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_admin_labels.html b/docs/reference/add_admin_labels.html new file mode 100644 index 0000000..a4c62c8 --- /dev/null +++ b/docs/reference/add_admin_labels.html @@ -0,0 +1,131 @@ + +Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels • visualizeR + Skip to contents + + +
+
+
+ +
+

Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels.

+
+ +
+

Usage

+
add_admin_labels(
+  point,
+  text,
+  size = 0.5,
+  fontface = "bold",
+  fontfamily = "Leelawadee",
+  shadow = TRUE,
+  auto_placement = FALSE,
+  remove_overlap = FALSE,
+  ...
+)
+
+ +
+

Arguments

+
point
+

Multipoint shape defined by sf package.

+ + +
text
+

Text labels column.

+ + +
size
+

Relative size of the text labels.

+ + +
fontface
+

Fontface.

+ + +
fontfamily
+

Fontfamily. Leelawadee is your precious.

+ + +
shadow
+

Boolean. Add a shadow around text labels. Issue opened on Github to request.

+ + +
auto_placement
+

Logical that determines whether the labels are placed automatically.

+ + +
remove_overlap
+

Logical that determines whether the overlapping labels are removed.

+ + +
...
+

Other arguments to pass to `tmap::tm_text()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_compass.html b/docs/reference/add_compass.html new file mode 100644 index 0000000..a5c56e2 --- /dev/null +++ b/docs/reference/add_compass.html @@ -0,0 +1,116 @@ + +Add a compass — add_compass • visualizeR + Skip to contents + + +
+
+
+ +
+

Add a compass

+
+ +
+

Usage

+
add_compass(
+  text_size = 0.6,
+  position = c("right", 0.8),
+  color_dark = cols_reach("black"),
+  text_color = cols_reach("black"),
+  type = "4star",
+  ...
+)
+
+ +
+

Arguments

+
text_size
+

Relative font size.

+ + +
position
+

Position of the compass. Vector of two values, specifying the x and y coordinates.

+ + +
color_dark
+

Color of the dark parts of the compass.

+ + +
text_color
+

color of the text.

+ + +
type
+

Compass type, one of: "arrow", "4star", "8star", "radar", "rose".

+ + +
...
+

Other arguments to pass to `tmap::tm_compass()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_credits.html b/docs/reference/add_credits.html new file mode 100644 index 0000000..785ce99 --- /dev/null +++ b/docs/reference/add_credits.html @@ -0,0 +1,105 @@ + +Do you want to credit someone or some institution? — add_credits • visualizeR + Skip to contents + + +
+
+
+ +
+

Do you want to credit someone or some institution?

+
+ +
+

Usage

+
add_credits(text, size = 0.4, bg_color = NA, position = c(0.75, 0.02), ...)
+
+ +
+

Arguments

+
text
+

Text.

+ + +
size
+

Relative text size.

+ + +
bg_color
+

Background color.

+ + +
position
+

Position. Vector of two coordinates. Usually somewhere down.

+ + +
...
+

Other arguments to pass to `tmap::tm_credits()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_indicator_layer.html b/docs/reference/add_indicator_layer.html new file mode 100644 index 0000000..4025c80 --- /dev/null +++ b/docs/reference/add_indicator_layer.html @@ -0,0 +1,161 @@ + +Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer • visualizeR + Skip to contents + + +
+
+
+ +
+

Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values

+
+ +
+

Usage

+
add_indicator_layer(
+  poly,
+  col,
+  buffer = NULL,
+  n = 5,
+  style = "pretty",
+  palette = pal_reach("red_5"),
+  as_count = TRUE,
+  color_na = cols_reach("white"),
+  text_na = "Missing data",
+  legend_title = "Proportion (%)",
+  legend_text_separator = " - ",
+  border_alpha = 1,
+  border_col = cols_reach("lt_grey_1"),
+  lwd = 1,
+  ...
+)
+
+ +
+

Arguments

+
poly
+

Multipolygon shape defined by sf package.

+ + +
col
+

Numeric attribute to map.

+ + +
buffer
+

A buffer, either one value or a vector of 4 values (left, bottom, right, top).

+ + +
n
+

The desire number of classes.

+ + +
style
+

Method to process the color scale for continuous numerical variables. See `classInt::classIntervals()` for details.

+ + +
palette
+

Vector of fill colors as hexadecimal values. For REACH color palettes, it is possible to use `pal_reach()`. For now,'palette' must be changed manually, accordingly to the number of drawn classes.

+ + +
as_count
+

Boolean. When col is a numeric variable, should it be processed as a count variable? For instance, 0, 1-10, 11-20.

+ + +
color_na
+

Fill color for missing data.

+ + +
text_na
+

Legend text for missing data.

+ + +
legend_title
+

Legend title.

+ + +
legend_text_separator
+

Text separator for classes. E.g. " to " will give 0, 1 to 10, 11 to 20.

+ + +
border_alpha
+

Transparency of the border.

+ + +
border_col
+

Color of the border.

+ + +
lwd
+

Linewidth of the border.

+ + +
...
+

Other arguments to pass to `tmap::tm_polygons()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_layout.html b/docs/reference/add_layout.html new file mode 100644 index 0000000..28a0f83 --- /dev/null +++ b/docs/reference/add_layout.html @@ -0,0 +1,141 @@ + +Basic defaults based on `tmap::tm_layout()` — add_layout • visualizeR + Skip to contents + + +
+
+
+ +
+

Basic defaults based on `tmap::tm_layout()`

+
+ +
+

Usage

+
add_layout(
+  title = NULL,
+  legend_position = c(0.02, 0.5),
+  frame = FALSE,
+  legend_frame = cols_reach("main_grey"),
+  legend_text_size = 0.6,
+  legend_title_size = 0.8,
+  title_size = 0.9,
+  title_fontface = "bold",
+  title_color = cols_reach("main_grey"),
+  fontfamily = "Leelawadee",
+  ...
+)
+
+ +
+

Arguments

+
title
+

Map title.

+ + +
legend_position
+

Legend position. Not above the map is a good start.

+ + +
frame
+

Boolean. Legend frame?

+ + +
legend_frame
+

Legend frame color.

+ + +
legend_text_size
+

Legend text size in 'pt'.

+ + +
legend_title_size
+

Legend title size in 'pt'.

+ + +
title_size
+

Title text size in 'pt'.

+ + +
title_fontface
+

Title fontface. Bold if you wanna exemplify a lot what it is about.

+ + +
title_color
+

Title font color.

+ + +
fontfamily
+

Overall fontfamily. Leelawadee is your precious.

+ + +
...
+

Other arguments to pass to `tmap::tm_layout()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/add_scale_bar.html b/docs/reference/add_scale_bar.html new file mode 100644 index 0000000..ad8d86d --- /dev/null +++ b/docs/reference/add_scale_bar.html @@ -0,0 +1,111 @@ + +Add a scale bar — add_scale_bar • visualizeR + Skip to contents + + +
+
+
+ +
+

Add a scale bar

+
+ +
+

Usage

+
add_scale_bar(
+  text_size = 0.6,
+  position = c("left", 0.01),
+  color_dark = cols_reach("black"),
+  breaks = c(0, 50, 100),
+  ...
+)
+
+ +
+

Arguments

+
text_size
+

Relative font size.

+ + +
position
+

Position of the compass. Vector of two values, specifying the x and y coordinates.

+ + +
color_dark
+

Color of the dark parts of the compass.

+ + +
breaks
+

Breaks of the scale bar. If not specified, breaks will be automatically be chosen given the prefered width of the scale bar. Example: c(0, 50, 100).

+ + +
...
+

Other arguments to pass to `tmap::tm_compass()`.

+ +
+
+

Value

+ + +

A tmap layer.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/alluvial.html b/docs/reference/alluvial.html new file mode 100644 index 0000000..1d2f2d0 --- /dev/null +++ b/docs/reference/alluvial.html @@ -0,0 +1,166 @@ + +Simple alluvial chart — alluvial • visualizeR + Skip to contents + + +
+
+
+ +
+

Simple alluvial chart

+
+ +
+

Usage

+
alluvial(
+  df,
+  from,
+  to,
+  value,
+  group = NULL,
+  alpha = 0.5,
+  from_levels = NULL,
+  value_title = NULL,
+  group_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  rect_color = cols_reach("white"),
+  rect_border_color = cols_reach("main_grey"),
+  rect_text_color = cols_reach("main_grey"),
+  theme = theme_reach(axis_y = FALSE, legend_position = "none")
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
from
+

A character column of upstream stratum.

+ + +
to
+

A character column of downstream stratum.

+ + +
value
+

A numeric column of values.

+ + +
group
+

The grouping column to fill the alluvium with.

+ + +
alpha
+

Fill transparency. Default to 0.5.

+ + +
from_levels
+

Order by given from levels?

+ + +
value_title
+

The value/y scale title. Default to NULL.

+ + +
group_title
+

The group title. Default to NULL.

+ + +
title
+

Plot title. Default to NULL.

+ + +
subtitle
+

Plot subtitle. Default to NULL.

+ + +
caption
+

Plot caption. Default to NULL.

+ + +
rect_color
+

Stratum rectangles' fill color.

+ + +
rect_border_color
+

Stratum rectangles' border color.

+ + +
rect_text_color
+

Stratum rectangles' text color.

+ + +
theme
+

Whatever theme. Default to theme_reach().

+ +
+
+

Value

+ + +

A donut chart to be used parsimoniously

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/bar.html b/docs/reference/bar.html new file mode 100644 index 0000000..e21989c --- /dev/null +++ b/docs/reference/bar.html @@ -0,0 +1,176 @@ + +Simple bar chart — bar • visualizeR + Skip to contents + + +
+
+
+ +
+

Simple bar chart

+
+ +
+

Usage

+
bar(
+  df,
+  x,
+  y,
+  group = NULL,
+  flip = TRUE,
+  percent = TRUE,
+  wrap = NULL,
+  position = "dodge",
+  alpha = 1,
+  x_title = NULL,
+  y_title = NULL,
+  group_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  add_text = FALSE,
+  add_text_suffix = "",
+  theme = theme_reach()
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
x
+

A numeric column.

+ + +
y
+

A character column or coercible as a character column.

+ + +
group
+

Some grouping categorical column, e.g. administrative areas or population groups.

+ + +
flip
+

TRUE or FALSE. Default to TRUE or horizontal bar plot.

+ + +
percent
+

TRUE or FALSE. Should the x-labels (and text labels if present) be displayed as percentages? Default to TRUE.

+ + +
wrap
+

Should x-labels be wrapped? Number of characters.

+ + +
position
+

Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack".

+ + +
alpha
+

Fill transparency.

+ + +
x_title
+

The x scale title. Default to NULL.

+ + +
y_title
+

The y scale title. Default to NULL.

+ + +
group_title
+

The group legend title. Default to NULL.

+ + +
title
+

Plot title. Default to NULL.

+ + +
subtitle
+

Plot subtitle. Default to NULL.

+ + +
caption
+

Plot caption. Default to NULL.

+ + +
add_text
+

TRUE or FALSE. Add the value as text.

+ + +
add_text_suffix
+

If percent is FALSE, should we add a suffix to the text label?

+ + +
theme
+

Whatever theme. Default to theme_reach().

+ +
+
+

Value

+ + +

A bar chart

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/border_admin0.html b/docs/reference/border_admin0.html new file mode 100644 index 0000000..59f8db5 --- /dev/null +++ b/docs/reference/border_admin0.html @@ -0,0 +1,102 @@ + +Haïti border. — border_admin0 • visualizeR + Skip to contents + + +
+
+
+ +
+

A multiline shapefile of Haiti's border.

+
+ +
+

Usage

+
border_admin0
+
+ +
+

Format

+

A sf multiline objet with 1 feature and 6 fields:

fid_1
+

fid_1

+ +
uno
+

uno

+ +
count
+

count

+ +
x_coord
+

x_coord

+ +
y_coord
+

y_coord

+ +
area
+

area

+ +
geometry
+

Multiline geometry.

+ + +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/buffer_bbox.html b/docs/reference/buffer_bbox.html new file mode 100644 index 0000000..b8ce00d --- /dev/null +++ b/docs/reference/buffer_bbox.html @@ -0,0 +1,93 @@ + +Bbbox buffer — buffer_bbox • visualizeR + Skip to contents + + +
+
+
+ +
+

Bbbox buffer

+
+ +
+

Usage

+
buffer_bbox(sf_obj, buffer = 0)
+
+ +
+

Arguments

+
sf_obj
+

A `sf` object

+ + +
buffer
+

A buffer, either one value or a vector of 4 values (left, bottom, right, top). Default to 0.

+ +
+
+

Value

+ + +

A bbox with a buffer

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/centroid_admin1.html b/docs/reference/centroid_admin1.html new file mode 100644 index 0000000..824e30b --- /dev/null +++ b/docs/reference/centroid_admin1.html @@ -0,0 +1,111 @@ + +Haïti admin 1 centroids shapefile. — centroid_admin1 • visualizeR + Skip to contents + + +
+
+
+ +
+

A multipoint shapefile of Haiti's admin 1.

+
+ +
+

Usage

+
centroid_admin1
+
+ +
+

Format

+

A sf multipoint object with 10 features and 9 fields:

ADM1_PC
+

Admin 1 postal code.

+ +
ADM1_EN
+

Full name in English.

+ +
ADM1_FR
+

Full name in French.

+ +
ADM1_HT
+

Full name in Haitian Creole.

+ +
ADM0_EN
+

Country name in English.

+ +
ADM0_FR
+

Country name in French.

+ +
ADM0_HT
+

Country name in Haitian Creole.

+ +
ADM0_PC
+

Country postal code.

+ +
ADM1_FR_UPPER
+

Admin 1 French name - uppercase.

+ +
geometry
+

Multipoint geometry.

+ + +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/cols_agora.html b/docs/reference/cols_agora.html index a532207..6b60cfb 100644 --- a/docs/reference/cols_agora.html +++ b/docs/reference/cols_agora.html @@ -1,5 +1,5 @@ -Function to extract AGORA colors as hex codes — cols_agora • visualizeRFunction to extract AGORA colors as hex codes — cols_agora • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Function to extract IMPACT colors as hex codes

+
+ +
+

Usage

+
cols_impact(..., unnamed = TRUE)
+
+ +
+

Arguments

+
...
+

Character names of reach colors. If NULL returns all colors

+ + +
unnamed
+

Should the output vector be unnamed? Default to `TRUE`

+ +
+
+

Value

+ + +

An hex code or hex codes named or unnamed

+
+
+

Details

+

This function needs to be modified to add colors

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/cols_reach.html b/docs/reference/cols_reach.html index f7cbdf4..9abda76 100644 --- a/docs/reference/cols_reach.html +++ b/docs/reference/cols_reach.html @@ -1,5 +1,5 @@ -Function to extract REACH colors as hex codes — cols_reach • visualizeRFunction to extract REACH colors as hex codes — cols_reach • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Simple donut chart (to be used parsimoniously), can be a pie chart

+
+ +
+

Usage

+
donut(
+  df,
+  x,
+  y,
+  alpha = 1,
+  x_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  arrange = TRUE,
+  hole_size = 3,
+  add_text = TRUE,
+  add_text_treshold_display = 5,
+  add_text_color = "white",
+  add_text_suffix = "",
+  theme = theme_reach(legend_reverse = TRUE)
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
x
+

A character column or coercible as a character column. Will give the donut's fill color.

+ + +
y
+

A numeric column.

+ + +
alpha
+

Fill transparency.

+ + +
x_title
+

The x scale title. Default to NULL.

+ + +
title
+

Plot title. Default to NULL.

+ + +
subtitle
+

Plot subtitle. Default to NULL.

+ + +
caption
+

Plot caption. Default to NULL.

+ + +
arrange
+

TRUE or FALSE. Arrange by highest percentage first.

+ + +
hole_size
+

Hole size. Default to 3. If less than 2, back to a pie chart.

+ + +
add_text
+

TRUE or FALSE. Add the value as text.

+ + +
add_text_treshold_display
+

Minimum value to add the text label.

+ + +
add_text_color
+

Text color.

+ + +
add_text_suffix
+

If percent is FALSE, should we add a suffix to the text label?

+ + +
theme
+

Whatever theme. Default to theme_reach().

+ +
+
+

Value

+ + +

A donut chart to be used parsimoniously

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/dumbbell.html b/docs/reference/dumbbell.html new file mode 100644 index 0000000..59d7e15 --- /dev/null +++ b/docs/reference/dumbbell.html @@ -0,0 +1,201 @@ + +Make dumbbell chart. — dumbbell • visualizeR + Skip to contents + + +
+
+
+ +
+

Make dumbbell chart.

+
+ +
+

Usage

+
dumbbell(
+  df,
+  col,
+  group_x,
+  group_y,
+  point_size = 5,
+  point_alpha = 1,
+  segment_size = 2.5,
+  segment_color = cols_reach("main_lt_grey"),
+  group_x_title = NULL,
+  group_y_title = NULL,
+  x_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  line_to_y_axis = TRUE,
+  line_to_y_axis_type = 3,
+  line_to_y_axis_width = 0.5,
+  line_to_y_axis_color = cols_reach("main_grey"),
+  add_text = TRUE,
+  add_text_vjust = 2,
+  add_text_size = 3.5,
+  add_text_color = cols_reach("main_grey"),
+  theme = theme_reach(palette = "primary")
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
col
+

A numeric column.

+ + +
group_x
+

The grouping column on the x-axis; only two groups.

+ + +
group_y
+

The grouping column on the y-axis.

+ + +
point_size
+

Point size.

+ + +
point_alpha
+

Point alpha.

+ + +
segment_size
+

Segment size.

+ + +
segment_color
+

Segment color.

+ + +
group_x_title
+

X-group and legend title.

+ + +
group_y_title
+

Y-axis and group title.

+ + +
x_title
+

X-axis title.

+ + +
title
+

Title.

+ + +
subtitle
+

Subtitle.

+ + +
caption
+

Caption.

+ + +
line_to_y_axis
+

TRUE or FALSE; add a line connected points and Y-axis.

+ + +
line_to_y_axis_type
+

Line to Y-axis type.

+ + +
line_to_y_axis_width
+

Line to Y-axis width.

+ + +
line_to_y_axis_color
+

Line to Y-axis color.

+ + +
add_text
+

TRUE or FALSE; add text at the points.

+ + +
add_text_vjust
+

Vertical adjustment.

+ + +
add_text_size
+

Text size.

+ + +
add_text_color
+

Text color.

+ + +
theme
+

A ggplot2 theme, default to `theme_reach()`

+ +
+
+

Value

+ + +

A dumbbell chart.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/figures/README-example-alluvial-plot-1.png b/docs/reference/figures/README-example-alluvial-plot-1.png new file mode 100644 index 0000000..f1c9284 Binary files /dev/null and b/docs/reference/figures/README-example-alluvial-plot-1.png differ diff --git a/docs/reference/figures/README-example-bar-chart-1.png b/docs/reference/figures/README-example-bar-chart-1.png new file mode 100644 index 0000000..246c204 Binary files /dev/null and b/docs/reference/figures/README-example-bar-chart-1.png differ diff --git a/docs/reference/figures/README-example-bar-chart-2.png b/docs/reference/figures/README-example-bar-chart-2.png new file mode 100644 index 0000000..f7a82d5 Binary files /dev/null and b/docs/reference/figures/README-example-bar-chart-2.png differ diff --git a/docs/reference/figures/README-example-bar-chart-3.png b/docs/reference/figures/README-example-bar-chart-3.png new file mode 100644 index 0000000..4066025 Binary files /dev/null and b/docs/reference/figures/README-example-bar-chart-3.png differ diff --git a/docs/reference/figures/README-example-donut-plot-1.png b/docs/reference/figures/README-example-donut-plot-1.png new file mode 100644 index 0000000..06aaf7a Binary files /dev/null and b/docs/reference/figures/README-example-donut-plot-1.png differ diff --git a/docs/reference/figures/README-example-dumbbell-plot-1.png b/docs/reference/figures/README-example-dumbbell-plot-1.png new file mode 100644 index 0000000..9236eb9 Binary files /dev/null and b/docs/reference/figures/README-example-dumbbell-plot-1.png differ diff --git a/docs/reference/figures/README-example-lollipop-chart-1.png b/docs/reference/figures/README-example-lollipop-chart-1.png new file mode 100644 index 0000000..2bc316c Binary files /dev/null and b/docs/reference/figures/README-example-lollipop-chart-1.png differ diff --git a/docs/reference/figures/README-example-lollipop-chart-2.png b/docs/reference/figures/README-example-lollipop-chart-2.png new file mode 100644 index 0000000..d6c4582 Binary files /dev/null and b/docs/reference/figures/README-example-lollipop-chart-2.png differ diff --git a/docs/reference/figures/README-example-map.png b/docs/reference/figures/README-example-map.png new file mode 100644 index 0000000..eb3162e Binary files /dev/null and b/docs/reference/figures/README-example-map.png differ diff --git a/docs/reference/figures/README-example-map.svg b/docs/reference/figures/README-example-map.svg new file mode 100644 index 0000000..5e389c0 --- /dev/null +++ b/docs/reference/figures/README-example-map.svg @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ARTIBONITE +NORD-OUEST +NORD +NORD-EST +OUEST +SUD-EST +SUD +GRANDE'ANSE +NIPPES +CENTRE +ARTIBONITE +NORD-OUEST +NORD +NORD-EST +OUEST +SUD-EST +SUD +GRANDE'ANSE +NIPPES +CENTRE +% of HH that reported open defecation as sanitation facility +Admin. boundaries. : CNIGS +Coord. system: GCS WGS 1984 + + +0 +50 +100 +km + + + + + + + + +N + + + +Proportion (%) + + + + + + + + + + +11 - 20 +21 - 30 +31 - 40 +41 - 50 +51 - 60 +Missing data + + + + + + + + +Administrative boundaries + + + + + + + +Department +Country +Dominican Rep. frontier + + + + + + diff --git a/docs/reference/figures/README-example-point-chart-1.png b/docs/reference/figures/README-example-point-chart-1.png new file mode 100644 index 0000000..de23c88 Binary files /dev/null and b/docs/reference/figures/README-example-point-chart-1.png differ diff --git a/docs/reference/figures/README-example-point-chart-2.png b/docs/reference/figures/README-example-point-chart-2.png new file mode 100644 index 0000000..9bfbd50 Binary files /dev/null and b/docs/reference/figures/README-example-point-chart-2.png differ diff --git a/docs/reference/figures/README-example-point-chart-3.png b/docs/reference/figures/README-example-point-chart-3.png new file mode 100644 index 0000000..d802343 Binary files /dev/null and b/docs/reference/figures/README-example-point-chart-3.png differ diff --git a/docs/reference/figures/logo.png b/docs/reference/figures/logo.png index 145688b..2945afe 100644 Binary files a/docs/reference/figures/logo.png and b/docs/reference/figures/logo.png differ diff --git a/docs/reference/frontier_admin0.html b/docs/reference/frontier_admin0.html new file mode 100644 index 0000000..91eeee8 --- /dev/null +++ b/docs/reference/frontier_admin0.html @@ -0,0 +1,108 @@ + +Haïti frontier with Dominican Republic. — frontier_admin0 • visualizeR + Skip to contents + + +
+
+
+ +
+

A multiline shapefile of Haiti's frontier with Dominican Republic.

+
+ +
+

Usage

+
frontier_admin0
+
+ +
+

Format

+

A sf multipoint objet with 4 features and 8 fields:

fid_1
+

fid_1

+ +
objectid
+

objectid

+ +
id
+

id

+ +
fromnode
+

fromnode

+ +
tonode
+

tonode

+ +
leftpolygo
+

leftpolygo

+ +
rightpolygo
+

rightpolygo

+ +
shape_leng
+

shape_leng

+ +
geometry
+

Multiline geometry.

+ + +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/if_not_in_stop.html b/docs/reference/if_not_in_stop.html new file mode 100644 index 0000000..8396b07 --- /dev/null +++ b/docs/reference/if_not_in_stop.html @@ -0,0 +1,101 @@ + +Stop statement "If not in colnames" with colnames — if_not_in_stop • visualizeR + Skip to contents + + +
+
+
+ +
+

Stop statement "If not in colnames" with colnames

+
+ +
+

Usage

+
if_not_in_stop(.tbl, cols, df, arg = NULL)
+
+ +
+

Arguments

+
.tbl
+

A tibble

+ + +
cols
+

A vector of column names (quoted)

+ + +
df
+

Provide the tibble name as a character string

+ + +
arg
+

Default to NULL.

+ +
+
+

Value

+ + +

A stop statement

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/if_vec_not_in_stop.html b/docs/reference/if_vec_not_in_stop.html new file mode 100644 index 0000000..fa8a565 --- /dev/null +++ b/docs/reference/if_vec_not_in_stop.html @@ -0,0 +1,101 @@ + +Stop statement "If not in vector" — if_vec_not_in_stop • visualizeR + Skip to contents + + +
+
+
+ +
+

Stop statement "If not in vector"

+
+ +
+

Usage

+
if_vec_not_in_stop(vec, cols, vec_name, arg = NULL)
+
+ +
+

Arguments

+
vec
+

A vector of character strings

+ + +
cols
+

A set of character strings

+ + +
vec_name
+

Provide the vector name as a character string

+ + +
arg
+

Default to NULL.

+ +
+
+

Value

+ + +

A stop statement if some elements of vec are not in cols

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index e898b76..1132a7d 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,5 +1,5 @@ -Function reference • visualizeRFunction reference • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

A multipolygon shapefile of Haiti's admin 1 with an indicator column 'opn_dfc'.

+
+ +
+

Usage

+
indicator_admin1
+
+ +
+

Format

+

A sf multipoint object with 10 features and 10 fields:

ADM1_PC
+

Admin 1 postal code.

+ +
admin1
+

Admin 1 unique id.

+ +
opn_dfc
+

Proportion of HHs that reported open defecation as sanitation facility.

+ +
ADM1_EN
+

Full name in English.

+ +
ADM1_FR
+

Full name in French.

+ +
ADM1_HT
+

Full name in Haitian Creole.

+ +
ADM0_EN
+

Country name in English.

+ +
ADM0_FR
+

Country name in French.

+ +
ADM0_HT
+

Country name in Haitian Creole.

+ +
ADM0_PC
+

Country postal code.

+ +
geometry
+

Multipolygon geometry.

+ + +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/line_admin1.html b/docs/reference/line_admin1.html new file mode 100644 index 0000000..929e507 --- /dev/null +++ b/docs/reference/line_admin1.html @@ -0,0 +1,105 @@ + +Haïti admin 1 lines shapefile. — line_admin1 • visualizeR + Skip to contents + + +
+
+
+ +
+

A multiline shapefile of Haiti's admin 1.

+
+ +
+

Usage

+
line_admin1
+
+ +
+

Format

+

A sf multiline object with 10 features and 8 fields:

ADM1_EN
+

Full name in English.

+ +
ADM1_FR
+

Full name in French.

+ +
ADM1_HT
+

Full name in Haitian Creole.

+ +
ADM0_EN
+

Country name in English.

+ +
ADM0_FR
+

Country name in French.

+ +
ADM0_HT
+

Country name in Haitian Creole.

+ +
ADM0_PCODE
+

Country postal code.

+ +
geometry
+

Multiline geometry.

+ + +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/lollipop.html b/docs/reference/lollipop.html new file mode 100644 index 0000000..551e5e4 --- /dev/null +++ b/docs/reference/lollipop.html @@ -0,0 +1,206 @@ + +Simple bar chart — lollipop • visualizeR + Skip to contents + + +
+
+
+ +
+

Simple bar chart

+
+ +
+

Usage

+
lollipop(
+  df,
+  x,
+  y,
+  flip = TRUE,
+  wrap = NULL,
+  arrange = TRUE,
+  point_size = 3,
+  point_color = cols_reach("main_red"),
+  point_alpha = 1,
+  segment_size = 1,
+  segment_color = cols_reach("main_grey"),
+  segment_alpha = 1,
+  alpha = 1,
+  x_title = NULL,
+  y_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  add_text = FALSE,
+  add_text_size = 3,
+  add_text_suffix = "",
+  add_text_color = "white",
+  add_text_fontface = "bold",
+  theme = theme_reach()
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
x
+

A numeric column.

+ + +
y
+

A character column or coercible as a character column.

+ + +
flip
+

TRUE or FALSE. Default to TRUE or horizontal lollipop plot.

+ + +
wrap
+

Should x-labels be wrapped? Number of characters.

+ + +
arrange
+

TRUE or FALSE. Arrange by highest percentage first.

+ + +
point_size
+

Point size.

+ + +
point_color
+

Point color.

+ + +
point_alpha
+

Point alpha.

+ + +
segment_size
+

Segment size.

+ + +
segment_color
+

Segment color.

+ + +
segment_alpha
+

Segment alpha.

+ + +
alpha
+

Fill transparency.

+ + +
x_title
+

The x scale title. Default to NULL.

+ + +
y_title
+

The y scale title. Default to NULL.

+ + +
title
+

Plot title. Default to NULL.

+ + +
subtitle
+

Plot subtitle. Default to NULL.

+ + +
caption
+

Plot caption. Default to NULL.

+ + +
add_text
+

TRUE or FALSE. Add the y value as text within the bubble.

+ + +
add_text_size
+

Text size.

+ + +
add_text_suffix
+

If percent is FALSE, should we add a suffix to the text label?

+ + +
add_text_color
+

Added text color. Default to white.

+ + +
add_text_fontface
+

Added text font face. Default to "bold".

+ + +
theme
+

Whatever theme. Default to theme_reach().

+ +
+
+

Value

+ + +

A bar chart

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/pal_agora.html b/docs/reference/pal_agora.html index 0754e06..50111bc 100644 --- a/docs/reference/pal_agora.html +++ b/docs/reference/pal_agora.html @@ -1,5 +1,5 @@ -Return function to interpolate an AGORA color palette — pal_agora • visualizeRReturn function to interpolate an AGORA color palette — pal_agora • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Return function to interpolate an IMPACT color palette

+
+ +
+

Usage

+
pal_impact(
+  palette = "main",
+  reverse = FALSE,
+  color_ramp_palette = FALSE,
+  show_palettes = FALSE,
+  ...
+)
+
+ +
+

Arguments

+
palette
+

Character name of a palette in IMPACT palettes

+ + +
reverse
+

Boolean indicating whether the palette should be reversed

+ + +
color_ramp_palette
+

Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the former with `TRUE`

+ + +
show_palettes
+

Should the ouput be the set of palettes names to pick from? Default to `FALSE`

+ + +
...
+

Additional arguments to pass to colorRampPalette()

+ +
+
+

Value

+ + +

A color palette

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/pal_reach.html b/docs/reference/pal_reach.html index af3c75f..c381173 100644 --- a/docs/reference/pal_reach.html +++ b/docs/reference/pal_reach.html @@ -1,5 +1,5 @@ -Return function to interpolate a REACH color palette — pal_reach • visualizeRReturn function to interpolate a REACH color palette — pal_reach • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Simple point chart

+
+ +
+

Usage

+
point(
+  df,
+  x,
+  y,
+  group = NULL,
+  flip = TRUE,
+  alpha = 1,
+  size = 1,
+  x_title = NULL,
+  y_title = NULL,
+  group_title = NULL,
+  title = NULL,
+  subtitle = NULL,
+  caption = NULL,
+  theme = theme_reach()
+)
+
+ +
+

Arguments

+
df
+

A data frame.

+ + +
x
+

A numeric column.

+ + +
y
+

A character column or coercible as a character column.

+ + +
group
+

Some grouping categorical column, e.g. administrative areas or population groups.

+ + +
flip
+

TRUE or FALSE. Default to TRUE or horizontal bar plot.

+ + +
alpha
+

Fill transparency.

+ + +
size
+

Point size.

+ + +
x_title
+

The x scale title. Default to NULL.

+ + +
y_title
+

The y scale title. Default to NULL.

+ + +
group_title
+

The group legend title. Default to NULL.

+ + +
title
+

Plot title. Default to NULL.

+ + +
subtitle
+

Plot subtitle. Default to NULL.

+ + +
caption
+

Plot caption. Default to NULL.

+ + +
theme
+

Whatever theme. Default to theme_reach().

+ +
+
+

Value

+ + +

A bar chart

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/scale_color.html b/docs/reference/scale_color.html index 6c5f1b1..e1a289f 100644 --- a/docs/reference/scale_color.html +++ b/docs/reference/scale_color.html @@ -1,7 +1,5 @@ -Color scale constructor for REACH or AGORA colors — scale_color • visualizeRColor scale constructor for REACH or AGORA colors — scale_color • visualizeR @@ -12,7 +10,7 @@ Fill scale constructor for REACH or AGORA colors">visualizeR - 0.1.0 + 0.7.9000 + + + + + +
+
+
+ +
+

Fill scale constructor for REACH or AGORA colors

+
+ +
+

Usage

+
scale_fill(
+  initiative = "reach",
+  palette = "main",
+  discrete = TRUE,
+  reverse = FALSE,
+  reverse_guide = TRUE,
+  ...
+)
+
+ +
+

Arguments

+
initiative
+

Either "reach" or "agora.

+ + +
palette
+

Palette name from `pal_reach()` or `pal_agora()`.

+ + +
discrete
+

Boolean indicating whether color aesthetic is discrete or not.

+ + +
reverse
+

Boolean indicating whether the palette should be reversed.

+ + +
reverse_guide
+

Boolean indicating whether the guide should be reversed.

+ + +
...
+

Additional arguments passed to discrete_scale() or +scale_fill_gradient(), used respectively when discrete is TRUE or FALSE.

+ +
+
+

Value

+ + +

A fill scale for ggplot.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/subvec_not_in.html b/docs/reference/subvec_not_in.html new file mode 100644 index 0000000..3cde8fc --- /dev/null +++ b/docs/reference/subvec_not_in.html @@ -0,0 +1,93 @@ + +Subvec not in — subvec_not_in • visualizeR + Skip to contents + + +
+
+
+ +
+

Subvec not in

+
+ +
+

Usage

+
subvec_not_in(vector, set)
+
+ +
+

Arguments

+
vector
+

A vector to subset

+ + +
set
+

A set-vector

+ +
+
+

Value

+ + +

A subset of vector not in set

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/docs/reference/theme_reach.html b/docs/reference/theme_reach.html index 6c3bd12..d1f7ec4 100644 --- a/docs/reference/theme_reach.html +++ b/docs/reference/theme_reach.html @@ -1,5 +1,5 @@ -Base REACH ggplot2 theme — theme_reach • visualizeRggplot2 theme with REACH color palettes — theme_reach • visualizeR @@ -10,7 +10,7 @@ visualizeR - 0.1.0 + 0.7.9000 - - - - - -
-
-
- -
-

Some REACH theme for ggplot

-
- -
-

Usage

-
theme_reach_borders(family = "Leelawadee")
-
- -
-

Arguments

-
family
-

The font family. Default to "Leelawadee"

-
-
-

Value

-

A theme to be added to the "+" ggplot grammar

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/theme_reach_flip_hist.html b/docs/reference/theme_reach_flip_hist.html deleted file mode 100644 index 936ddb5..0000000 --- a/docs/reference/theme_reach_flip_hist.html +++ /dev/null @@ -1,86 +0,0 @@ - -Some reach more minimal theme for ggplot — theme_reach_flip_hist • visualizeR - Skip to contents - - -
-
-
- -
-

Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for horizontal bar charts.

-
- -
-

Usage

-
theme_reach_flip_hist(family = "Leelawadee")
-
- -
-

Arguments

-
family
-

The font family. Default to "Leelawadee"

-
-
-

Value

-

A theme to be added to the "+" ggplot grammar

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/theme_reach_hist.html b/docs/reference/theme_reach_hist.html deleted file mode 100644 index f05fcf9..0000000 --- a/docs/reference/theme_reach_hist.html +++ /dev/null @@ -1,86 +0,0 @@ - -Some reach more minimal theme for ggplot — theme_reach_hist • visualizeR - Skip to contents - - -
-
-
- -
-

Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for vertical bar charts.

-
- -
-

Usage

-
theme_reach_hist(family = "Leelawadee")
-
- -
-

Arguments

-
family
-

The font family. Default to "Leelawadee"

-
-
-

Value

-

A theme to be added to the "+" ggplot grammar

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/search.json b/docs/search.json index 68e4ad8..e505ab7 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://gnoblet.github.io/visualizeR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Noblet Guillaume. Author, maintainer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Guillaume N (2022). visualizeR: color! viz!. https://github.com/gnoblet/visualizeR, https://gnoblet.github.io/visualizeR/.","code":"@Manual{, title = {visualizeR: What a color! What a viz!}, author = {Noblet Guillaume}, year = {2022}, note = {https://github.com/gnoblet/visualizeR, https://gnoblet.github.io/visualizeR/}, }"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"visualizer-","dir":"","previous_headings":"","what":"What a color! What a viz!","title":"What a color! What a viz!","text":"color! viz! visualizeR proposes utils get REACH AGORA colors, ready--go color palettes, visualization functions (horizontal hist graph instance).","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"What a color! What a viz!","text":"can install last version visualizeR GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"gnoblet/visualizeR\", build_vignettes = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"roadmap","dir":"","previous_headings":"","what":"Roadmap","title":"What a color! What a viz!","text":"Roadmap follows: Add IMPACT’s colors Add color palettes internal documentation Add new types visualization (e.g. dumbbell plot) Use examples Add ease-map functions Add interactive functions (maps graphs)","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"request","dir":"","previous_headings":"","what":"Request","title":"What a color! What a viz!","text":"Please, hesitate pull request new viz colors color palettes, email request change (guillaume.noblet@reach-initiative.org gnoblet@zaclys.net).","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"What a color! What a viz!","text":"","code":"library(visualizeR) # Get all saved REACH colors, named cols_reach(unnamed = F)"},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to extract AGORA colors as hex codes — cols_agora","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"Function extract AGORA colors hex codes","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"","code":"cols_agora(..., unnamed = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"... Character names reach colors. NULL returns colors unnamed output vector unnamed? Default `TRUE`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"hex code hex codes named unnamed","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"function needs modified add colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to extract REACH colors as hex codes — cols_reach","title":"Function to extract REACH colors as hex codes — cols_reach","text":"Function extract REACH colors hex codes","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to extract REACH colors as hex codes — cols_reach","text":"","code":"cols_reach(..., unnamed = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to extract REACH colors as hex codes — cols_reach","text":"... Character names reach colors. NULL returns colors unnamed output vector unnamed? Default `TRUE`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to extract REACH colors as hex codes — cols_reach","text":"hex code hex codes named unnamed","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Function to extract REACH colors as hex codes — cols_reach","text":"function needs modified add colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":null,"dir":"Reference","previous_headings":"","what":"Return function to interpolate an AGORA color palette — pal_agora","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"Return function interpolate AGORA color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"","code":"pal_agora( palette = \"main\", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"palette Character name palette AGORA palettes reverse Boolean indicating whether palette reversed color_ramp_palette output `grDevices::colorRampPalette` function vector hex codes? Default former `TRUE` show_palettes ouput set palettes names pick ? Default `FALSE` ... Additional arguments pass colorRampPalette()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"Return function to interpolate a REACH color palette — pal_reach","title":"Return function to interpolate a REACH color palette — pal_reach","text":"Return function interpolate REACH color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return function to interpolate a REACH color palette — pal_reach","text":"","code":"pal_reach( palette = \"main\", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return function to interpolate a REACH color palette — pal_reach","text":"palette Character name palette REACH palettes reverse Boolean indicating whether palette reversed color_ramp_palette output `grDevices::colorRampPalette` function vector hex codes? Default former `TRUE` show_palettes ouput set palettes names pick ? Default `FALSE` ... Additional arguments pass colorRampPalette()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return function to interpolate a REACH color palette — pal_reach","text":"color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Color scale constructor for REACH or AGORA colors — scale_color","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"Color scale constructor REACH AGORA colors Fill scale constructor REACH AGORA colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"","code":"scale_color( initiative = \"reach\", palette = \"main\", discrete = TRUE, reverse = FALSE, ... ) scale_color( initiative = \"reach\", palette = \"main\", discrete = TRUE, reverse = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"initiative Either \"reach\" \"agora palette Character name palette drsimonj_palettes discrete Boolean indicating whether color aesthetic discrete reverse Boolean indicating whether palette reversed ... Additional arguments passed discrete_scale() scale_fill_gradientn(), used respectively discrete TRUE FALSE","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"color scale ggplot fill scale ggplot","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"Base REACH ggplot2 theme — theme_reach","title":"Base REACH ggplot2 theme — theme_reach","text":"Give reach colors fonts ggplot. Based theme_bw()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Base REACH ggplot2 theme — theme_reach","text":"","code":"theme_reach(family = \"Leelawadee\")"},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Base REACH ggplot2 theme — theme_reach","text":"family font family. Default \"Leelawadee\"","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Base REACH ggplot2 theme — theme_reach","text":"base REACH theme","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_borders.html","id":null,"dir":"Reference","previous_headings":"","what":"Some REACH theme for ggplot — theme_reach_borders","title":"Some REACH theme for ggplot — theme_reach_borders","text":"REACH theme ggplot","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_borders.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Some REACH theme for ggplot — theme_reach_borders","text":"","code":"theme_reach_borders(family = \"Leelawadee\")"},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_borders.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Some REACH theme for ggplot — theme_reach_borders","text":"family font family. Default \"Leelawadee\"","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_borders.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Some REACH theme for ggplot — theme_reach_borders","text":"theme added \"+\" ggplot grammar","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_flip_hist.html","id":null,"dir":"Reference","previous_headings":"","what":"Some reach more minimal theme for ggplot — theme_reach_flip_hist","title":"Some reach more minimal theme for ggplot — theme_reach_flip_hist","text":"Give REACH colors fonts ggplot. Based theme_bw(). used horizontal bar charts.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_flip_hist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Some reach more minimal theme for ggplot — theme_reach_flip_hist","text":"","code":"theme_reach_flip_hist(family = \"Leelawadee\")"},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_flip_hist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Some reach more minimal theme for ggplot — theme_reach_flip_hist","text":"family font family. Default \"Leelawadee\"","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_flip_hist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Some reach more minimal theme for ggplot — theme_reach_flip_hist","text":"theme added \"+\" ggplot grammar","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_hist.html","id":null,"dir":"Reference","previous_headings":"","what":"Some reach more minimal theme for ggplot — theme_reach_hist","title":"Some reach more minimal theme for ggplot — theme_reach_hist","text":"Give REACH colors fonts ggplot. Based theme_bw(). used vertical bar charts.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_hist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Some reach more minimal theme for ggplot — theme_reach_hist","text":"","code":"theme_reach_hist(family = \"Leelawadee\")"},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_hist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Some reach more minimal theme for ggplot — theme_reach_hist","text":"family font family. Default \"Leelawadee\"","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach_hist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Some reach more minimal theme for ggplot — theme_reach_hist","text":"theme added \"+\" ggplot grammar","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-010","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.0","title":"visualizeR 0.1.0","text":"Added NEWS.md file track changes package. Initiate repo","code":""}] +[{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://gnoblet.github.io/visualizeR/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://gnoblet.github.io/visualizeR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Noblet Guillaume. Author, maintainer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Guillaume N (2023). visualizeR: color! viz!. https://github.com/gnoblet/visualizeR, https://gnoblet.github.io/visualizeR/.","code":"@Manual{, title = {visualizeR: What a color! What a viz!}, author = {Noblet Guillaume}, year = {2023}, note = {https://github.com/gnoblet/visualizeR, https://gnoblet.github.io/visualizeR/}, }"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"visualizer-","dir":"","previous_headings":"","what":"What a color! What a viz!","title":"What a color! What a viz!","text":"color! viz! visualizeR proposes utils get REACH AGORA colors, ready--go color palettes, visualization functions (horizontal hist graph instance).","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"What a color! What a viz!","text":"can install last version visualizeR GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"gnoblet/visualizeR\", build_vignettes = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"roadmap","dir":"","previous_headings":"","what":"Roadmap","title":"What a color! What a viz!","text":"Roadmap follows: Add IMPACT’s colors Add color palettes internal documentation remains added --7-color palettes black color palettes Add new types visualization (e.g. dumbbell plot, lollipop plot, etc.) Use examples Add ease-map functions Add interactive functions (maps graphs) Consolidate make errors transparent","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"request","dir":"","previous_headings":"","what":"Request","title":"What a color! What a viz!","text":"Please, hesitate pull request new viz colors color palettes, email request change (guillaume.noblet@reach-initiative.org gnoblet@zaclys.net).","code":""},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"colors","dir":"","previous_headings":"","what":"Colors","title":"What a color! What a viz!","text":"Color palettes REACH, AGORA IMPACT available. Functions access colors palettes cols_initiative() pal_initiative(). now, initiative colors color palettes REACH. Feel free pull requests new AGORA IMPACT colors.","code":"library(visualizeR) # Get all saved REACH colors, named cols_reach(unnamed = F)[1:10] #> white black main_grey main_red main_lt_grey main_beige #> \"#FFFFFF\" \"#000000\" \"#58585A\" \"#EE5859\" \"#C7C8CA\" \"#D2CBB8\" #> iroise_1 iroise_2 iroise_3 iroise_4 #> \"#DFECEF\" \"#B1D7E0\" \"#699DA3\" \"#236A7A\" # Extract a color palette as hexadecimal codes and reversed pal_reach(palette = \"main\", reversed = TRUE, color_ramp_palette = FALSE) #> [1] \"#58585A\" \"#EE5859\" \"#C7C8CA\" \"#D2CBB8\" # Get all color palettes names pal_reach(show_palettes = T) #> [1] \"main\" \"primary\" \"secondary\" \"two_dots\" #> [5] \"two_dots_flashy\" \"red_main\" \"red_main_5\" \"red_alt\" #> [9] \"red_alt_5\" \"iroise\" \"iroise_5\" \"discrete_6\" #> [13] \"red_2\" \"red_3\" \"red_4\" \"red_5\" #> [17] \"red_6\" \"red_7\" \"green_2\" \"green_3\" #> [21] \"green_4\" \"green_5\" \"green_6\" \"green_7\" #> [25] \"artichoke_2\" \"artichoke_3\" \"artichoke_4\" \"artichoke_5\" #> [29] \"artichoke_6\" \"artichoke_7\" \"blue_2\" \"blue_3\" #> [33] \"blue_4\" \"blue_5\" \"blue_6\" \"blue_7\""},{"path":[]},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-1-bar-chart-already-reach-themed","dir":"","previous_headings":"Charts","what":"Example 1: Bar chart, already REACH themed","title":"What a color! What a viz!","text":"","code":"library(visualizeR) library(palmerpenguins) library(dplyr) df <- penguins |> group_by(island, species) |> summarize( mean_bl = mean(bill_length_mm, na.rm = T), mean_fl = mean(flipper_length_mm, na.rm = T)) |> ungroup() # Simple bar chart by group with some alpha transparency bar(df, island, mean_bl, species, percent = FALSE, alpha = 0.6, x_title = \"Mean of bill length\") # Using another color palette through `theme_reach()` and changing scale to percent bar(df, island,mean_bl, species, percent = TRUE, theme = theme_reach(palette = \"artichoke_3\")) # Not flipped, with text added, group_title, no y-axis and no bold for legend bar(df, island, mean_bl, species, group_title = \"Species\", flip = FALSE, add_text = TRUE, add_text_suffix = \"%\", percent = FALSE, theme = theme_reach(text_font_face = \"plain\", axis_y = FALSE))"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-2-point-chart-already-reach-themed","dir":"","previous_headings":"Charts","what":"Example 2: Point chart, already REACH themed","title":"What a color! What a viz!","text":"stage, point_reach() supports categorical grouping colors group arg.","code":"# Simple point chart point(penguins, bill_length_mm, flipper_length_mm) # Point chart with grouping colors, greater dot size, some transparency, reversed color palette point(penguins, bill_length_mm, flipper_length_mm, island, alpha = 0.6, size = 3, theme = theme_reach(reverse = TRUE)) # Using another color palettes point(penguins, bill_length_mm, flipper_length_mm, island, size = 1.5, x_title = \"Bill\", y_title = \"Flipper\", title = \"Length (mm)\", theme = theme_reach(palette = \"artichoke_3\", text_font_face = , grid_major_x = TRUE, title_position_to_plot = FALSE))"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-3-dumbbell-plot-reach-themed","dir":"","previous_headings":"Charts","what":"Example 3: Dumbbell plot, REACH themed","title":"What a color! What a viz!","text":"Remember ensure data long format two groups x-axis; instance, IDP returnee NA values.","code":"# Prepare long data df <- tibble::tibble( admin1 = rep(letters[1:8], 2), setting = c(rep(c(\"Rural\", \"Urban\"), 4), rep(c(\"Urban\", \"Rural\"), 4)), stat = rnorm(16, mean = 50, sd = 18) ) |> dplyr::mutate(stat = round(stat, 0)) # Example, adding a parameter to `theme_reach()` passed on `ggplot2::theme()` to align legend title dumbbell(df, stat, setting, admin1, title = \"% of HHs that reported open defecation as sanitation facility\", group_y_title = \"Admin 1\", group_x_title = \"Setting\", theme = theme_reach(legend_position = \"bottom\", legend_direction = \"horizontal\", legend_title_font_face = \"bold\", palette = \"primary\", title_position_to_plot = FALSE, legend.title.align = 0.5)) + # Change legend title position (could be included as part of the function) ggplot2::guides( color = ggplot2::guide_legend(title.position = \"left\"), fill = ggplot2::guide_legend(title.position = \"left\") )"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-4-donut-chart-reach-themed-to-used-moderately","dir":"","previous_headings":"Charts","what":"Example 4: donut chart, REACH themed (to used moderately)","title":"What a color! What a viz!","text":"","code":"# Some summarized data: % of HHs by displacement status df <- tibble::tibble( status = c(\"Displaced\", \"Non displaced\", \"Returnee\", \"Don't know/Prefer not to say\"), percentage = c(18, 65, 12, 3) ) # Donut donut(df, status, percentage, hole_size = 3, add_text_suffix = \"%\", add_text_color = cols_reach(\"dk_grey\"), add_text_treshold_display = 5, x_title = \"Displacement status\", title = \"% of HHs by displacement status\", theme = theme_reach(legend_reverse = TRUE))"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-5-alluvial-chart-reach-themed","dir":"","previous_headings":"Charts","what":"Example 5: alluvial chart, REACH themed","title":"What a color! What a viz!","text":"","code":"# Some summarized data: % of HHs by self-reported status of displacement in 2021 and in 2022 df <- tibble::tibble( status_from = c(rep(\"Displaced\", 4), rep(\"Non displaced\", 4), rep(\"Returnee\", 4), rep(\"Dnk/Pnts\", 4)), status_to = c(\"Displaced\", \"Non displaced\", \"Returnee\", \"Dnk/Pnts\", \"Displaced\", \"Non displaced\", \"Returnee\", \"Dnk/Pnts\", \"Displaced\", \"Non displaced\", \"Returnee\", \"Dnk/Pnts\", \"Displaced\", \"Non displaced\", \"Returnee\", \"Dnk/Pnts\"), percentage = c(20, 8, 18, 1, 12, 21, 0, 2, 0, 3, 12, 1, 0, 0, 1, 1) ) # Alluvial, here the group is the status for 2021 alluvial(df, status_from, status_to, percentage, status_from, from_levels = c(\"Displaced\", \"Non displaced\", \"Returnee\", \"Dnk/Pnts\"), alpha = 0.8, group_title = \"Status for 2021\", title = \"% of HHs by self-reported status from 2021 to 2022\", theme = theme_reach( axis_y = FALSE, legend_position = \"none\"))"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"example-6-lollipop-chart","dir":"","previous_headings":"Charts","what":"Example 6: lollipop chart","title":"What a color! What a viz!","text":"","code":"library(tidyr) # Prepare long data df <- tibble::tibble( admin1 = replicate(15, sample(letters, 8)) |> t() |> as.data.frame() |> unite(\"admin1\", sep = \"\") |> dplyr::pull(admin1), stat = rnorm(15, mean = 50, sd = 15)) |> dplyr::mutate(stat = round(stat, 0)) # Make lollipop plot, REACH themed, vertical with 45 degrees angle X-labels lollipop(df, admin1, stat, arrange = FALSE, add_text = FALSE, flip = FALSE, y_title = \"% of HHs\", x_title = \"Admin 1\", title = \"% of HHs that reported having received a humanitarian assistance\", theme = theme_reach(axis_text_x_angle = 45, grid_major_y = TRUE, grid_major_y_size = 0.2, grid_major_x = TRUE, grid_minor_y = TRUE)) # Horizontal, greater point size, arranged by value, no grid, and text labels added lollipop(df, admin1, stat, arrange = TRUE, point_size = 10, point_color = cols_reach(\"main_beige\"), segment_size = 2, add_text = TRUE, add_text_suffix = \"%\", y_title = \"% of HHs\", x_title = \"Admin 1\", title = \"% of HHs that reported having received a humanitarian assistance in the 12 months prior to the assessment\", theme = theme_reach(title_position_to_plot = FALSE))"},{"path":"https://gnoblet.github.io/visualizeR/index.html","id":"maps","dir":"","previous_headings":"","what":"Maps","title":"What a color! What a viz!","text":"exported tmap::tmap_save().","code":"# Add indicator layer # - based on \"pretty\" classes and title \"Proportion (%)\" # - buffer to add a 10% around the bounding box map <- add_indicator_layer( indicator_admin1, opn_dfc, buffer = 0.1) + # Layout - some defaults - add the map title add_layout(\"% of HH that reported open defecation as sanitation facility\") + # Admin boundaries as list of shape files (lines) and colors, line widths and labels as vectors add_admin_boundaries( lines = list(line_admin1, border_admin0, frontier_admin0), colors = cols_reach(\"main_lt_grey\", \"dk_grey\", \"black\"), lwds = c(0.5, 2, 3), labels = c(\"Department\", \"Country\", \"Dominican Rep. frontier\"), title = \"Administrative boundaries\") + # Add text labels - centered on admin 1 centroids add_admin_labels(centroid_admin1, ADM1_FR_UPPER) + # Add a compass add_compass() + # Add a scale bar add_scale_bar() + # Add credits add_credits(\"Admin. boundaries. : CNIGS \\nCoord. system: GCS WGS 1984\")"},{"path":"https://gnoblet.github.io/visualizeR/reference/abort_bad_argument.html","id":null,"dir":"Reference","previous_headings":"","what":"Abord bad argument — abort_bad_argument","title":"Abord bad argument — abort_bad_argument","text":"Abord bad argument","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/abort_bad_argument.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Abord bad argument — abort_bad_argument","text":"","code":"abort_bad_argument(arg, must, not = NULL)"},{"path":"https://gnoblet.github.io/visualizeR/reference/abort_bad_argument.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Abord bad argument — abort_bad_argument","text":"arg argument must arg must Optional. arg must .","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/abort_bad_argument.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Abord bad argument — abort_bad_argument","text":"stop statement","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_boundaries.html","id":null,"dir":"Reference","previous_headings":"","what":"Add admin boundaries (lines) and the legend — add_admin_boundaries","title":"Add admin boundaries (lines) and the legend — add_admin_boundaries","text":"Add admin boundaries (lines) legend","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_boundaries.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add admin boundaries (lines) and the legend — add_admin_boundaries","text":"","code":"add_admin_boundaries( lines, colors, labels, lwds, title = \"\", buffer = NULL, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_boundaries.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add admin boundaries (lines) and the legend — add_admin_boundaries","text":"lines List multiline shape defined sf package. colors Vector hexadecimal codes. order lines. labels Vector labels legend. order lines. lwds Vector line widths. order lines. title Legend title. buffer buffer, either one value vector 4 values (left, bottom, right, top). ... arguments pass shape `tmap::tm_lines()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_boundaries.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add admin boundaries (lines) and the legend — add_admin_boundaries","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels","title":"Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels","text":"Wrapper around `tmap::tm_text()` sane defaults plotting admin labels.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels","text":"","code":"add_admin_labels( point, text, size = 0.5, fontface = \"bold\", fontfamily = \"Leelawadee\", shadow = TRUE, auto_placement = FALSE, remove_overlap = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels","text":"point Multipoint shape defined sf package. text Text labels column. size Relative size text labels. fontface Fontface. fontfamily Fontfamily. Leelawadee precious. shadow Boolean. Add shadow around text labels. Issue opened Github request. auto_placement Logical determines whether labels placed automatically. remove_overlap Logical determines whether overlapping labels removed. ... arguments pass `tmap::tm_text()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_admin_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. — add_admin_labels","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_compass.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a compass — add_compass","title":"Add a compass — add_compass","text":"Add compass","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_compass.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a compass — add_compass","text":"","code":"add_compass( text_size = 0.6, position = c(\"right\", 0.8), color_dark = cols_reach(\"black\"), text_color = cols_reach(\"black\"), type = \"4star\", ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_compass.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a compass — add_compass","text":"text_size Relative font size. position Position compass. Vector two values, specifying x y coordinates. color_dark Color dark parts compass. text_color color text. type Compass type, one : \"arrow\", \"4star\", \"8star\", \"radar\", \"rose\". ... arguments pass `tmap::tm_compass()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_compass.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a compass — add_compass","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_credits.html","id":null,"dir":"Reference","previous_headings":"","what":"Do you want to credit someone or some institution? — add_credits","title":"Do you want to credit someone or some institution? — add_credits","text":"want credit someone institution?","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_credits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Do you want to credit someone or some institution? — add_credits","text":"","code":"add_credits(text, size = 0.4, bg_color = NA, position = c(0.75, 0.02), ...)"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_credits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Do you want to credit someone or some institution? — add_credits","text":"text Text. size Relative text size. bg_color Background color. position Position. Vector two coordinates. Usually somewhere . ... arguments pass `tmap::tm_credits()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_credits.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Do you want to credit someone or some institution? — add_credits","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_indicator_layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer","title":"Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer","text":"Wrapper around `tmap::tm_polygons()` sane defaults plotting indicator values","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_indicator_layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer","text":"","code":"add_indicator_layer( poly, col, buffer = NULL, n = 5, style = \"pretty\", palette = pal_reach(\"red_5\"), as_count = TRUE, color_na = cols_reach(\"white\"), text_na = \"Missing data\", legend_title = \"Proportion (%)\", legend_text_separator = \" - \", border_alpha = 1, border_col = cols_reach(\"lt_grey_1\"), lwd = 1, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_indicator_layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer","text":"poly Multipolygon shape defined sf package. col Numeric attribute map. buffer buffer, either one value vector 4 values (left, bottom, right, top). n desire number classes. style Method process color scale continuous numerical variables. See `classInt::classIntervals()` details. palette Vector fill colors hexadecimal values. REACH color palettes, possible use `pal_reach()`. now,'palette' must changed manually, accordingly number drawn classes. as_count Boolean. col numeric variable, processed count variable? instance, 0, 1-10, 11-20. color_na Fill color missing data. text_na Legend text missing data. legend_title Legend title. legend_text_separator Text separator classes. E.g. \" \" give 0, 1 10, 11 20. border_alpha Transparency border. border_col Color border. lwd Linewidth border. ... arguments pass `tmap::tm_polygons()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_indicator_layer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values — add_indicator_layer","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_layout.html","id":null,"dir":"Reference","previous_headings":"","what":"Basic defaults based on `tmap::tm_layout()` — add_layout","title":"Basic defaults based on `tmap::tm_layout()` — add_layout","text":"Basic defaults based `tmap::tm_layout()`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_layout.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Basic defaults based on `tmap::tm_layout()` — add_layout","text":"","code":"add_layout( title = NULL, legend_position = c(0.02, 0.5), frame = FALSE, legend_frame = cols_reach(\"main_grey\"), legend_text_size = 0.6, legend_title_size = 0.8, title_size = 0.9, title_fontface = \"bold\", title_color = cols_reach(\"main_grey\"), fontfamily = \"Leelawadee\", ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_layout.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Basic defaults based on `tmap::tm_layout()` — add_layout","text":"title Map title. legend_position Legend position. map good start. frame Boolean. Legend frame? legend_frame Legend frame color. legend_text_size Legend text size 'pt'. legend_title_size Legend title size 'pt'. title_size Title text size 'pt'. title_fontface Title fontface. Bold wanna exemplify lot . title_color Title font color. fontfamily Overall fontfamily. Leelawadee precious. ... arguments pass `tmap::tm_layout()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_layout.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Basic defaults based on `tmap::tm_layout()` — add_layout","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_scale_bar.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a scale bar — add_scale_bar","title":"Add a scale bar — add_scale_bar","text":"Add scale bar","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_scale_bar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a scale bar — add_scale_bar","text":"","code":"add_scale_bar( text_size = 0.6, position = c(\"left\", 0.01), color_dark = cols_reach(\"black\"), breaks = c(0, 50, 100), ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/add_scale_bar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a scale bar — add_scale_bar","text":"text_size Relative font size. position Position compass. Vector two values, specifying x y coordinates. color_dark Color dark parts compass. breaks Breaks scale bar. specified, breaks automatically chosen given prefered width scale bar. Example: c(0, 50, 100). ... arguments pass `tmap::tm_compass()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/add_scale_bar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a scale bar — add_scale_bar","text":"tmap layer.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/alluvial.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple alluvial chart — alluvial","title":"Simple alluvial chart — alluvial","text":"Simple alluvial chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/alluvial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple alluvial chart — alluvial","text":"","code":"alluvial( df, from, to, value, group = NULL, alpha = 0.5, from_levels = NULL, value_title = NULL, group_title = NULL, title = NULL, subtitle = NULL, caption = NULL, rect_color = cols_reach(\"white\"), rect_border_color = cols_reach(\"main_grey\"), rect_text_color = cols_reach(\"main_grey\"), theme = theme_reach(axis_y = FALSE, legend_position = \"none\") )"},{"path":"https://gnoblet.github.io/visualizeR/reference/alluvial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple alluvial chart — alluvial","text":"df data frame. character column upstream stratum. character column downstream stratum. value numeric column values. group grouping column fill alluvium . alpha Fill transparency. Default 0.5. from_levels Order given levels? value_title value/y scale title. Default NULL. group_title group title. Default NULL. title Plot title. Default NULL. subtitle Plot subtitle. Default NULL. caption Plot caption. Default NULL. rect_color Stratum rectangles' fill color. rect_border_color Stratum rectangles' border color. rect_text_color Stratum rectangles' text color. theme Whatever theme. Default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/alluvial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple alluvial chart — alluvial","text":"donut chart used parsimoniously","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/bar.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple bar chart — bar","title":"Simple bar chart — bar","text":"Simple bar chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/bar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple bar chart — bar","text":"","code":"bar( df, x, y, group = NULL, flip = TRUE, percent = TRUE, wrap = NULL, position = \"dodge\", alpha = 1, x_title = NULL, y_title = NULL, group_title = NULL, title = NULL, subtitle = NULL, caption = NULL, add_text = FALSE, add_text_suffix = \"\", theme = theme_reach() )"},{"path":"https://gnoblet.github.io/visualizeR/reference/bar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple bar chart — bar","text":"df data frame. x numeric column. y character column coercible character column. group grouping categorical column, e.g. administrative areas population groups. flip TRUE FALSE. Default TRUE horizontal bar plot. percent TRUE FALSE. x-labels (text labels present) displayed percentages? Default TRUE. wrap x-labels wrapped? Number characters. position chart stacked? Default \"dodge\". Can take \"dodge\" \"stack\". alpha Fill transparency. x_title x scale title. Default NULL. y_title y scale title. Default NULL. group_title group legend title. Default NULL. title Plot title. Default NULL. subtitle Plot subtitle. Default NULL. caption Plot caption. Default NULL. add_text TRUE FALSE. Add value text. add_text_suffix percent FALSE, add suffix text label? theme Whatever theme. Default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/bar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple bar chart — bar","text":"bar chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/border_admin0.html","id":null,"dir":"Reference","previous_headings":"","what":"Haïti border. — border_admin0","title":"Haïti border. — border_admin0","text":"multiline shapefile Haiti's border.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/border_admin0.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Haïti border. — border_admin0","text":"","code":"border_admin0"},{"path":"https://gnoblet.github.io/visualizeR/reference/border_admin0.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Haïti border. — border_admin0","text":"sf multiline objet 1 feature 6 fields: fid_1 fid_1 uno uno count count x_coord x_coord y_coord y_coord area area geometry Multiline geometry.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/buffer_bbox.html","id":null,"dir":"Reference","previous_headings":"","what":"Bbbox buffer — buffer_bbox","title":"Bbbox buffer — buffer_bbox","text":"Bbbox buffer","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/buffer_bbox.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bbbox buffer — buffer_bbox","text":"","code":"buffer_bbox(sf_obj, buffer = 0)"},{"path":"https://gnoblet.github.io/visualizeR/reference/buffer_bbox.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bbbox buffer — buffer_bbox","text":"sf_obj `sf` object buffer buffer, either one value vector 4 values (left, bottom, right, top). Default 0.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/buffer_bbox.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bbbox buffer — buffer_bbox","text":"bbox buffer","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/centroid_admin1.html","id":null,"dir":"Reference","previous_headings":"","what":"Haïti admin 1 centroids shapefile. — centroid_admin1","title":"Haïti admin 1 centroids shapefile. — centroid_admin1","text":"multipoint shapefile Haiti's admin 1.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/centroid_admin1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Haïti admin 1 centroids shapefile. — centroid_admin1","text":"","code":"centroid_admin1"},{"path":"https://gnoblet.github.io/visualizeR/reference/centroid_admin1.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Haïti admin 1 centroids shapefile. — centroid_admin1","text":"sf multipoint object 10 features 9 fields: ADM1_PC Admin 1 postal code. ADM1_EN Full name English. ADM1_FR Full name French. ADM1_HT Full name Haitian Creole. ADM0_EN Country name English. ADM0_FR Country name French. ADM0_HT Country name Haitian Creole. ADM0_PC Country postal code. ADM1_FR_UPPER Admin 1 French name - uppercase. geometry Multipoint geometry.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to extract AGORA colors as hex codes — cols_agora","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"Function extract AGORA colors hex codes","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"","code":"cols_agora(..., unnamed = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"... Character names reach colors. NULL returns colors unnamed output vector unnamed? Default `TRUE`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"hex code hex codes named unnamed","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_agora.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Function to extract AGORA colors as hex codes — cols_agora","text":"function needs modified add colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_impact.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to extract IMPACT colors as hex codes — cols_impact","title":"Function to extract IMPACT colors as hex codes — cols_impact","text":"Function extract IMPACT colors hex codes","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_impact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to extract IMPACT colors as hex codes — cols_impact","text":"","code":"cols_impact(..., unnamed = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_impact.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to extract IMPACT colors as hex codes — cols_impact","text":"... Character names reach colors. NULL returns colors unnamed output vector unnamed? Default `TRUE`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_impact.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to extract IMPACT colors as hex codes — cols_impact","text":"hex code hex codes named unnamed","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_impact.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Function to extract IMPACT colors as hex codes — cols_impact","text":"function needs modified add colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to extract REACH colors as hex codes — cols_reach","title":"Function to extract REACH colors as hex codes — cols_reach","text":"Function extract REACH colors hex codes","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to extract REACH colors as hex codes — cols_reach","text":"","code":"cols_reach(..., unnamed = TRUE)"},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to extract REACH colors as hex codes — cols_reach","text":"... Character names reach colors. NULL returns colors unnamed output vector unnamed? Default `TRUE`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to extract REACH colors as hex codes — cols_reach","text":"hex code hex codes named unnamed","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/cols_reach.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Function to extract REACH colors as hex codes — cols_reach","text":"function needs modified add colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/donut.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple donut chart (to be used parsimoniously), can be a pie chart — donut","title":"Simple donut chart (to be used parsimoniously), can be a pie chart — donut","text":"Simple donut chart (used parsimoniously), can pie chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/donut.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple donut chart (to be used parsimoniously), can be a pie chart — donut","text":"","code":"donut( df, x, y, alpha = 1, x_title = NULL, title = NULL, subtitle = NULL, caption = NULL, arrange = TRUE, hole_size = 3, add_text = TRUE, add_text_treshold_display = 5, add_text_color = \"white\", add_text_suffix = \"\", theme = theme_reach(legend_reverse = TRUE) )"},{"path":"https://gnoblet.github.io/visualizeR/reference/donut.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple donut chart (to be used parsimoniously), can be a pie chart — donut","text":"df data frame. x character column coercible character column. give donut's fill color. y numeric column. alpha Fill transparency. x_title x scale title. Default NULL. title Plot title. Default NULL. subtitle Plot subtitle. Default NULL. caption Plot caption. Default NULL. arrange TRUE FALSE. Arrange highest percentage first. hole_size Hole size. Default 3. less 2, back pie chart. add_text TRUE FALSE. Add value text. add_text_treshold_display Minimum value add text label. add_text_color Text color. add_text_suffix percent FALSE, add suffix text label? theme Whatever theme. Default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/donut.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple donut chart (to be used parsimoniously), can be a pie chart — donut","text":"donut chart used parsimoniously","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/dumbbell.html","id":null,"dir":"Reference","previous_headings":"","what":"Make dumbbell chart. — dumbbell","title":"Make dumbbell chart. — dumbbell","text":"Make dumbbell chart.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/dumbbell.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make dumbbell chart. — dumbbell","text":"","code":"dumbbell( df, col, group_x, group_y, point_size = 5, point_alpha = 1, segment_size = 2.5, segment_color = cols_reach(\"main_lt_grey\"), group_x_title = NULL, group_y_title = NULL, x_title = NULL, title = NULL, subtitle = NULL, caption = NULL, line_to_y_axis = TRUE, line_to_y_axis_type = 3, line_to_y_axis_width = 0.5, line_to_y_axis_color = cols_reach(\"main_grey\"), add_text = TRUE, add_text_vjust = 2, add_text_size = 3.5, add_text_color = cols_reach(\"main_grey\"), theme = theme_reach(palette = \"primary\") )"},{"path":"https://gnoblet.github.io/visualizeR/reference/dumbbell.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make dumbbell chart. — dumbbell","text":"df data frame. col numeric column. group_x grouping column x-axis; two groups. group_y grouping column y-axis. point_size Point size. point_alpha Point alpha. segment_size Segment size. segment_color Segment color. group_x_title X-group legend title. group_y_title Y-axis group title. x_title X-axis title. title Title. subtitle Subtitle. caption Caption. line_to_y_axis TRUE FALSE; add line connected points Y-axis. line_to_y_axis_type Line Y-axis type. line_to_y_axis_width Line Y-axis width. line_to_y_axis_color Line Y-axis color. add_text TRUE FALSE; add text points. add_text_vjust Vertical adjustment. add_text_size Text size. add_text_color Text color. theme ggplot2 theme, default `theme_reach()`","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/dumbbell.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make dumbbell chart. — dumbbell","text":"dumbbell chart.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/frontier_admin0.html","id":null,"dir":"Reference","previous_headings":"","what":"Haïti frontier with Dominican Republic. — frontier_admin0","title":"Haïti frontier with Dominican Republic. — frontier_admin0","text":"multiline shapefile Haiti's frontier Dominican Republic.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/frontier_admin0.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Haïti frontier with Dominican Republic. — frontier_admin0","text":"","code":"frontier_admin0"},{"path":"https://gnoblet.github.io/visualizeR/reference/frontier_admin0.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Haïti frontier with Dominican Republic. — frontier_admin0","text":"sf multipoint objet 4 features 8 fields: fid_1 fid_1 objectid objectid id id fromnode fromnode tonode tonode leftpolygo leftpolygo rightpolygo rightpolygo shape_leng shape_leng geometry Multiline geometry.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_not_in_stop.html","id":null,"dir":"Reference","previous_headings":"","what":"Stop statement ","title":"Stop statement ","text":"Stop statement \"colnames\" colnames","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_not_in_stop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stop statement ","text":"","code":"if_not_in_stop(.tbl, cols, df, arg = NULL)"},{"path":"https://gnoblet.github.io/visualizeR/reference/if_not_in_stop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stop statement ","text":".tbl tibble cols vector column names (quoted) df Provide tibble name character string arg Default NULL.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_not_in_stop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stop statement ","text":"stop statement","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_vec_not_in_stop.html","id":null,"dir":"Reference","previous_headings":"","what":"Stop statement ","title":"Stop statement ","text":"Stop statement \"vector\"","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_vec_not_in_stop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stop statement ","text":"","code":"if_vec_not_in_stop(vec, cols, vec_name, arg = NULL)"},{"path":"https://gnoblet.github.io/visualizeR/reference/if_vec_not_in_stop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stop statement ","text":"vec vector character strings cols set character strings vec_name Provide vector name character string arg Default NULL.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/if_vec_not_in_stop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stop statement ","text":"stop statement elements vec cols","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/indicator_admin1.html","id":null,"dir":"Reference","previous_headings":"","what":"Indicator admin 1 polygons shapefile. — indicator_admin1","title":"Indicator admin 1 polygons shapefile. — indicator_admin1","text":"multipolygon shapefile Haiti's admin 1 indicator column 'opn_dfc'.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/indicator_admin1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Indicator admin 1 polygons shapefile. — indicator_admin1","text":"","code":"indicator_admin1"},{"path":"https://gnoblet.github.io/visualizeR/reference/indicator_admin1.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Indicator admin 1 polygons shapefile. — indicator_admin1","text":"sf multipoint object 10 features 10 fields: ADM1_PC Admin 1 postal code. admin1 Admin 1 unique id. opn_dfc Proportion HHs reported open defecation sanitation facility. ADM1_EN Full name English. ADM1_FR Full name French. ADM1_HT Full name Haitian Creole. ADM0_EN Country name English. ADM0_FR Country name French. ADM0_HT Country name Haitian Creole. ADM0_PC Country postal code. geometry Multipolygon geometry.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/line_admin1.html","id":null,"dir":"Reference","previous_headings":"","what":"Haïti admin 1 lines shapefile. — line_admin1","title":"Haïti admin 1 lines shapefile. — line_admin1","text":"multiline shapefile Haiti's admin 1.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/line_admin1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Haïti admin 1 lines shapefile. — line_admin1","text":"","code":"line_admin1"},{"path":"https://gnoblet.github.io/visualizeR/reference/line_admin1.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Haïti admin 1 lines shapefile. — line_admin1","text":"sf multiline object 10 features 8 fields: ADM1_EN Full name English. ADM1_FR Full name French. ADM1_HT Full name Haitian Creole. ADM0_EN Country name English. ADM0_FR Country name French. ADM0_HT Country name Haitian Creole. ADM0_PCODE Country postal code. geometry Multiline geometry.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/lollipop.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple bar chart — lollipop","title":"Simple bar chart — lollipop","text":"Simple bar chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/lollipop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple bar chart — lollipop","text":"","code":"lollipop( df, x, y, flip = TRUE, wrap = NULL, arrange = TRUE, point_size = 3, point_color = cols_reach(\"main_red\"), point_alpha = 1, segment_size = 1, segment_color = cols_reach(\"main_grey\"), segment_alpha = 1, alpha = 1, x_title = NULL, y_title = NULL, title = NULL, subtitle = NULL, caption = NULL, add_text = FALSE, add_text_size = 3, add_text_suffix = \"\", add_text_color = \"white\", add_text_fontface = \"bold\", theme = theme_reach() )"},{"path":"https://gnoblet.github.io/visualizeR/reference/lollipop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple bar chart — lollipop","text":"df data frame. x numeric column. y character column coercible character column. flip TRUE FALSE. Default TRUE horizontal lollipop plot. wrap x-labels wrapped? Number characters. arrange TRUE FALSE. Arrange highest percentage first. point_size Point size. point_color Point color. point_alpha Point alpha. segment_size Segment size. segment_color Segment color. segment_alpha Segment alpha. alpha Fill transparency. x_title x scale title. Default NULL. y_title y scale title. Default NULL. title Plot title. Default NULL. subtitle Plot subtitle. Default NULL. caption Plot caption. Default NULL. add_text TRUE FALSE. Add y value text within bubble. add_text_size Text size. add_text_suffix percent FALSE, add suffix text label? add_text_color Added text color. Default white. add_text_fontface Added text font face. Default \"bold\". theme Whatever theme. Default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/lollipop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple bar chart — lollipop","text":"bar chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":null,"dir":"Reference","previous_headings":"","what":"Return function to interpolate an AGORA color palette — pal_agora","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"Return function interpolate AGORA color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"","code":"pal_agora( palette = \"main\", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"palette Character name palette AGORA palettes reverse Boolean indicating whether palette reversed color_ramp_palette output `grDevices::colorRampPalette` function vector hex codes? Default former `TRUE` show_palettes ouput set palettes names pick ? Default `FALSE` ... Additional arguments pass colorRampPalette()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_agora.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return function to interpolate an AGORA color palette — pal_agora","text":"color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_impact.html","id":null,"dir":"Reference","previous_headings":"","what":"Return function to interpolate an IMPACT color palette — pal_impact","title":"Return function to interpolate an IMPACT color palette — pal_impact","text":"Return function interpolate IMPACT color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_impact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return function to interpolate an IMPACT color palette — pal_impact","text":"","code":"pal_impact( palette = \"main\", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_impact.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return function to interpolate an IMPACT color palette — pal_impact","text":"palette Character name palette IMPACT palettes reverse Boolean indicating whether palette reversed color_ramp_palette output `grDevices::colorRampPalette` function vector hex codes? Default former `TRUE` show_palettes ouput set palettes names pick ? Default `FALSE` ... Additional arguments pass colorRampPalette()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_impact.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return function to interpolate an IMPACT color palette — pal_impact","text":"color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"Return function to interpolate a REACH color palette — pal_reach","title":"Return function to interpolate a REACH color palette — pal_reach","text":"Return function interpolate REACH color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return function to interpolate a REACH color palette — pal_reach","text":"","code":"pal_reach( palette = \"main\", reverse = FALSE, color_ramp_palette = FALSE, show_palettes = FALSE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return function to interpolate a REACH color palette — pal_reach","text":"palette Character name palette REACH palettes reverse Boolean indicating whether palette reversed color_ramp_palette output `grDevices::colorRampPalette` function vector hex codes? Default former `TRUE` show_palettes ouput set palettes names pick ? Default `FALSE` ... Additional arguments pass colorRampPalette()","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/pal_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return function to interpolate a REACH color palette — pal_reach","text":"color palette","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/point.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple point chart — point","title":"Simple point chart — point","text":"Simple point chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple point chart — point","text":"","code":"point( df, x, y, group = NULL, flip = TRUE, alpha = 1, size = 1, x_title = NULL, y_title = NULL, group_title = NULL, title = NULL, subtitle = NULL, caption = NULL, theme = theme_reach() )"},{"path":"https://gnoblet.github.io/visualizeR/reference/point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple point chart — point","text":"df data frame. x numeric column. y character column coercible character column. group grouping categorical column, e.g. administrative areas population groups. flip TRUE FALSE. Default TRUE horizontal bar plot. alpha Fill transparency. size Point size. x_title x scale title. Default NULL. y_title y scale title. Default NULL. group_title group legend title. Default NULL. title Plot title. Default NULL. subtitle Plot subtitle. Default NULL. caption Plot caption. Default NULL. theme Whatever theme. Default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/point.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple point chart — point","text":"bar chart","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Color scale constructor for REACH or AGORA colors — scale_color","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"Color scale constructor REACH AGORA colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"","code":"scale_color( initiative = \"reach\", palette = \"main\", discrete = TRUE, reverse = FALSE, reverse_guide = TRUE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"initiative Either \"reach\" \"agora. palette Palette name `pal_reach()` `pal_agora()`. discrete Boolean indicating whether color aesthetic discrete . reverse Boolean indicating whether palette reversed. reverse_guide Boolean indicating whether guide reversed. ... Additional arguments passed discrete_scale() scale_fill_gradient(), used respectively discrete TRUE FALSE.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Color scale constructor for REACH or AGORA colors — scale_color","text":"color scale ggplot","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_fill.html","id":null,"dir":"Reference","previous_headings":"","what":"Fill scale constructor for REACH or AGORA colors — scale_fill","title":"Fill scale constructor for REACH or AGORA colors — scale_fill","text":"Fill scale constructor REACH AGORA colors","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_fill.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fill scale constructor for REACH or AGORA colors — scale_fill","text":"","code":"scale_fill( initiative = \"reach\", palette = \"main\", discrete = TRUE, reverse = FALSE, reverse_guide = TRUE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_fill.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fill scale constructor for REACH or AGORA colors — scale_fill","text":"initiative Either \"reach\" \"agora. palette Palette name `pal_reach()` `pal_agora()`. discrete Boolean indicating whether color aesthetic discrete . reverse Boolean indicating whether palette reversed. reverse_guide Boolean indicating whether guide reversed. ... Additional arguments passed discrete_scale() scale_fill_gradient(), used respectively discrete TRUE FALSE.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/scale_fill.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fill scale constructor for REACH or AGORA colors — scale_fill","text":"fill scale ggplot.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/subvec_not_in.html","id":null,"dir":"Reference","previous_headings":"","what":"Subvec not in — subvec_not_in","title":"Subvec not in — subvec_not_in","text":"Subvec ","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/subvec_not_in.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subvec not in — subvec_not_in","text":"","code":"subvec_not_in(vector, set)"},{"path":"https://gnoblet.github.io/visualizeR/reference/subvec_not_in.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subvec not in — subvec_not_in","text":"vector vector subset set set-vector","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/subvec_not_in.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subvec not in — subvec_not_in","text":"subset vector set","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":null,"dir":"Reference","previous_headings":"","what":"ggplot2 theme with REACH color palettes — theme_reach","title":"ggplot2 theme with REACH color palettes — theme_reach","text":"Give reach colors fonts ggplot.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ggplot2 theme with REACH color palettes — theme_reach","text":"","code":"theme_reach( palette = \"main\", discrete = TRUE, reverse = FALSE, font_family = \"Segoe UI\", title_size = 12, title_color = cols_reach(\"main_grey\"), title_font_face = \"bold\", title_position_to_plot = TRUE, text_size = 10, text_color = cols_reach(\"main_grey\"), text_font_face = \"plain\", panel_background_color = \"#FFFFFF\", legend_position = \"right\", legend_direction = \"vertical\", legend_reverse = TRUE, legend_title_size = 11, legend_title_color = cols_reach(\"main_grey\"), legend_title_font_face = \"plain\", legend_text_size = 10, legend_text_color = cols_reach(\"main_grey\"), legend_text_font_face = \"plain\", axis_x = TRUE, axis_y = TRUE, axis_text_size = 10, axis_text_color = cols_reach(\"main_grey\"), axis_text_font_face = \"plain\", axis_title_size = 11, axis_title_color = cols_reach(\"main_grey\"), axis_title_font_face = \"bold\", axis_text_x_angle = 0, axis_text_x_vjust = 0.5, axis_text_x_hjust = 0.5, grid_major_x = FALSE, grid_major_y = FALSE, grid_major_color = cols_reach(\"main_lt_grey\"), grid_major_x_size = 0.1, grid_major_y_size = 0.1, grid_minor_x = FALSE, grid_minor_y = FALSE, grid_minor_color = cols_reach(\"main_lt_grey\"), grid_minor_x_size = 0.05, grid_minor_y_size = 0.05, caption_position_to_plot = TRUE, ... )"},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ggplot2 theme with REACH color palettes — theme_reach","text":"palette Palette name 'pal_reach()'. discrete Boolean indicating whether color aesthetic discrete . reverse Boolean indicating whether palette reversed. font_family font family plot's texts. Default \"Leelawadee\". title_size size legend title. Defaults 11. title_color Legend title color. title_font_face Legend title font face. Default \"plain\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). title_position_to_plot TRUE FALSE. Positioning plot panel? text_size size text title, subtitle caption. Defaults 10. text_color Text color. text_font_face Text font face. Default \"bold\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). panel_background_color color panel background color. Default white. legend_position Position legend; Default \"right\". Can take \"right\", \"left\", \"top\", \"bottom\" \"none\". legend_direction Direction legend. Default \"vertical\". Can take \"vertical\" \"horizontal\". legend_reverse Reverse color guide? Default TRUE. legend_title_size Legend title size. legend_title_color Legend title color. legend_title_font_face Legend title font face. Default \"plain\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). legend_text_size Legend text size. legend_text_color Legend text color. legend_text_font_face Legend text font face. Default \"plain\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). axis_x Boolean. need x-axis? axis_y Boolean. need y-axis? axis_text_size Axis text size. axis_text_color Axis text color. axis_text_font_face Axis text font face. Default \"plain\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). axis_title_size Axis title size. axis_title_color Axis title color. axis_title_font_face Axis title font face. Default \"plain\". Font face (\"plain\", \"italic\", \"bold\", \"bold.italic\"). axis_text_x_angle Angle x-axis text. axis_text_x_vjust Vertical adjustment x-axis text. axis_text_x_hjust Vertical adjustment x-axis text. grid_major_x Boolean. need major grid lines x-axis? grid_major_y Boolean. need major grid lines y-axis? grid_major_color Major grid lines color. grid_major_x_size Major X line size. grid_major_y_size Major Y line size. grid_minor_x Boolean. need minor grid lines x-axis? grid_minor_y Boolean. need minor grid lines y-axis? grid_minor_color Minor grid lines color. grid_minor_x_size Minor X line size. grid_minor_y_size Minor Y line size. caption_position_to_plot TRUE FALSE. Positioning plot panel? ... Additional arguments passed `ggplot2::gg_theme()`.","code":""},{"path":"https://gnoblet.github.io/visualizeR/reference/theme_reach.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ggplot2 theme with REACH color palettes — theme_reach","text":"base REACH theme","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-069000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.6.9000","title":"visualizeR 0.6.9000","text":"Add dumbbell(). Add alluvial() Add donut() Add lollipop() Add parameters theme_reach(), including grid lines args.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-069000-1","dir":"Changelog","previous_headings":"","what":"visualizeR 0.6.9000","title":"visualizeR 0.6.9000","text":"Add dumbbell(). Add parameters theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-059000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.5.9000","title":"visualizeR 0.5.9000","text":"Add wrapping title, subtitle caption thanks ggtext Add wrapping labels bar() x-discrete scale. Add parameters theme_reach()","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-049000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.4.9000","title":"visualizeR 0.4.9000","text":"Breaking changes: remove dependency ggblanket. Full rewrite theme_reach(). bar_reach now bar() theming passed argument theme default theme_reach(). point_reach now point() theming passed argument theme default theme_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-039000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.3.9000","title":"visualizeR 0.3.9000","text":"Breaking changes: update ggblanket v1.6.1. Add plotting functions indicator maps.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-029000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.2.9000","title":"visualizeR 0.2.9000","text":"Breaking changes: almost functions got refinements, new functions, typically hbar() becomes bar_reach() point_reach() added. Following theme_reach() now used plotting functions. Add README.md.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0179000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.7.9000","title":"visualizeR 0.1.7.9000","text":"Fixed color palettes.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0169000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.6.9000","title":"visualizeR 0.1.6.9000","text":"IMPACT colors palettes added: function cols_impact() pal_impact(). Color palettes REACH added (2 7 continuous palettes) ; see updated cols_reach() pal_reach().","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0159000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.5.9000","title":"visualizeR 0.1.5.9000","text":"Move simplevis successor ggblanket.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0149000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.4.9000","title":"visualizeR 0.1.4.9000","text":"hbar() gains new boolean argument reverse pass pal_reach() pal_agora(), indicating color palette reversed .","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0139000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.3.9000","title":"visualizeR 0.1.3.9000","text":"Small change hbar(): removes error arg within simplevis::gg_hbar() call.","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0129000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.2.9000","title":"visualizeR 0.1.2.9000","text":"duplicate scale_color() function, now scale_fill()","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-0119000","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.1.9000","title":"visualizeR 0.1.1.9000","text":"Added two horizontal bar functions: hbar(), hbar_percent() (#3) Added internals check missing columns bad arguments (#3) Modified theme_reach() documentation Add buffer_bbox() function produce buffered bbox, e.g. use tmap","code":""},{"path":"https://gnoblet.github.io/visualizeR/news/index.html","id":"visualizer-010","dir":"Changelog","previous_headings":"","what":"visualizeR 0.1.0","title":"visualizeR 0.1.0","text":"Added NEWS.md file track changes package Initiate repo","code":""}] diff --git a/docs/sitemap.xml b/docs/sitemap.xml index d1822fc..82003ee 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -3,6 +3,9 @@ https://gnoblet.github.io/visualizeR/404.html + + https://gnoblet.github.io/visualizeR/LICENSE.html + https://gnoblet.github.io/visualizeR/authors.html @@ -10,39 +13,105 @@ https://gnoblet.github.io/visualizeR/index.html - https://gnoblet.github.io/visualizeR/LICENSE.html + https://gnoblet.github.io/visualizeR/news/index.html - https://gnoblet.github.io/visualizeR/news/index.html + https://gnoblet.github.io/visualizeR/reference/abort_bad_argument.html + + + https://gnoblet.github.io/visualizeR/reference/add_admin_boundaries.html + + + https://gnoblet.github.io/visualizeR/reference/add_admin_labels.html + + + https://gnoblet.github.io/visualizeR/reference/add_compass.html + + + https://gnoblet.github.io/visualizeR/reference/add_credits.html + + + https://gnoblet.github.io/visualizeR/reference/add_indicator_layer.html + + + https://gnoblet.github.io/visualizeR/reference/add_layout.html + + + https://gnoblet.github.io/visualizeR/reference/add_scale_bar.html + + + https://gnoblet.github.io/visualizeR/reference/alluvial.html + + + https://gnoblet.github.io/visualizeR/reference/bar.html + + + https://gnoblet.github.io/visualizeR/reference/border_admin0.html + + + https://gnoblet.github.io/visualizeR/reference/buffer_bbox.html + + + https://gnoblet.github.io/visualizeR/reference/centroid_admin1.html https://gnoblet.github.io/visualizeR/reference/cols_agora.html + + https://gnoblet.github.io/visualizeR/reference/cols_impact.html + https://gnoblet.github.io/visualizeR/reference/cols_reach.html + + https://gnoblet.github.io/visualizeR/reference/donut.html + + + https://gnoblet.github.io/visualizeR/reference/dumbbell.html + + + https://gnoblet.github.io/visualizeR/reference/frontier_admin0.html + + + https://gnoblet.github.io/visualizeR/reference/if_not_in_stop.html + + + https://gnoblet.github.io/visualizeR/reference/if_vec_not_in_stop.html + https://gnoblet.github.io/visualizeR/reference/index.html + + https://gnoblet.github.io/visualizeR/reference/indicator_admin1.html + + + https://gnoblet.github.io/visualizeR/reference/line_admin1.html + + + https://gnoblet.github.io/visualizeR/reference/lollipop.html + https://gnoblet.github.io/visualizeR/reference/pal_agora.html + + https://gnoblet.github.io/visualizeR/reference/pal_impact.html + https://gnoblet.github.io/visualizeR/reference/pal_reach.html + + https://gnoblet.github.io/visualizeR/reference/point.html + https://gnoblet.github.io/visualizeR/reference/scale_color.html + + https://gnoblet.github.io/visualizeR/reference/scale_fill.html + + + https://gnoblet.github.io/visualizeR/reference/subvec_not_in.html + https://gnoblet.github.io/visualizeR/reference/theme_reach.html - - https://gnoblet.github.io/visualizeR/reference/theme_reach_borders.html - - - https://gnoblet.github.io/visualizeR/reference/theme_reach_flip_hist.html - - - https://gnoblet.github.io/visualizeR/reference/theme_reach_hist.html - diff --git a/man/abort_bad_argument.Rd b/man/abort_bad_argument.Rd new file mode 100644 index 0000000..02ec558 --- /dev/null +++ b/man/abort_bad_argument.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internals.R +\name{abort_bad_argument} +\alias{abort_bad_argument} +\title{Abord bad argument} +\usage{ +abort_bad_argument(arg, must, not = NULL) +} +\arguments{ +\item{arg}{An argument} + +\item{must}{What arg must be} + +\item{not}{Optional. What arg must not be.} +} +\value{ +A stop statement +} +\description{ +Abord bad argument +} diff --git a/man/add_admin_boundaries.Rd b/man/add_admin_boundaries.Rd new file mode 100644 index 0000000..7d6e3b4 --- /dev/null +++ b/man/add_admin_boundaries.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_admin_boundaries} +\alias{add_admin_boundaries} +\title{Add admin boundaries (lines) and the legend} +\usage{ +add_admin_boundaries( + lines, + colors, + labels, + lwds, + title = "", + buffer = NULL, + ... +) +} +\arguments{ +\item{lines}{List of multiline shape defined by sf package.} + +\item{colors}{Vector of hexadecimal codes. Same order as lines.} + +\item{labels}{Vector of labels in the legend. Same order as lines.} + +\item{lwds}{Vector of line widths. Same order as lines.} + +\item{title}{Legend title.} + +\item{buffer}{A buffer, either one value or a vector of 4 values (left, bottom, right, top).} + +\item{...}{Other arguments to pass to each shape in `tmap::tm_lines()`.} +} +\value{ +A tmap layer. +} +\description{ +Add admin boundaries (lines) and the legend +} diff --git a/man/add_admin_labels.Rd b/man/add_admin_labels.Rd new file mode 100644 index 0000000..d9691b6 --- /dev/null +++ b/man/add_admin_labels.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_admin_labels} +\alias{add_admin_labels} +\title{Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels.} +\usage{ +add_admin_labels( + point, + text, + size = 0.5, + fontface = "bold", + fontfamily = "Leelawadee", + shadow = TRUE, + auto_placement = FALSE, + remove_overlap = FALSE, + ... +) +} +\arguments{ +\item{point}{Multipoint shape defined by sf package.} + +\item{text}{Text labels column.} + +\item{size}{Relative size of the text labels.} + +\item{fontface}{Fontface.} + +\item{fontfamily}{Fontfamily. Leelawadee is your precious.} + +\item{shadow}{Boolean. Add a shadow around text labels. Issue opened on Github to request.} + +\item{auto_placement}{Logical that determines whether the labels are placed automatically.} + +\item{remove_overlap}{Logical that determines whether the overlapping labels are removed.} + +\item{...}{Other arguments to pass to `tmap::tm_text()`.} +} +\value{ +A tmap layer. +} +\description{ +Wrapper around `tmap::tm_text()` with sane defaults for plotting admin labels. +} diff --git a/man/add_compass.Rd b/man/add_compass.Rd new file mode 100644 index 0000000..a22f932 --- /dev/null +++ b/man/add_compass.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_compass} +\alias{add_compass} +\title{Add a compass} +\usage{ +add_compass( + text_size = 0.6, + position = c("right", 0.8), + color_dark = cols_reach("black"), + text_color = cols_reach("black"), + type = "4star", + ... +) +} +\arguments{ +\item{text_size}{Relative font size.} + +\item{position}{Position of the compass. Vector of two values, specifying the x and y coordinates.} + +\item{color_dark}{Color of the dark parts of the compass.} + +\item{text_color}{color of the text.} + +\item{type}{Compass type, one of: "arrow", "4star", "8star", "radar", "rose".} + +\item{...}{Other arguments to pass to `tmap::tm_compass()`.} +} +\value{ +A tmap layer. +} +\description{ +Add a compass +} diff --git a/man/add_credits.Rd b/man/add_credits.Rd new file mode 100644 index 0000000..9410747 --- /dev/null +++ b/man/add_credits.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_credits} +\alias{add_credits} +\title{Do you want to credit someone or some institution?} +\usage{ +add_credits(text, size = 0.4, bg_color = NA, position = c(0.75, 0.02), ...) +} +\arguments{ +\item{text}{Text.} + +\item{size}{Relative text size.} + +\item{bg_color}{Background color.} + +\item{position}{Position. Vector of two coordinates. Usually somewhere down.} + +\item{...}{Other arguments to pass to `tmap::tm_credits()`.} +} +\value{ +A tmap layer. +} +\description{ +Do you want to credit someone or some institution? +} diff --git a/man/add_indicator_layer.Rd b/man/add_indicator_layer.Rd new file mode 100644 index 0000000..cf54ac2 --- /dev/null +++ b/man/add_indicator_layer.Rd @@ -0,0 +1,61 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_indicator_layer} +\alias{add_indicator_layer} +\title{Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values} +\usage{ +add_indicator_layer( + poly, + col, + buffer = NULL, + n = 5, + style = "pretty", + palette = pal_reach("red_5"), + as_count = TRUE, + color_na = cols_reach("white"), + text_na = "Missing data", + legend_title = "Proportion (\%)", + legend_text_separator = " - ", + border_alpha = 1, + border_col = cols_reach("lt_grey_1"), + lwd = 1, + ... +) +} +\arguments{ +\item{poly}{Multipolygon shape defined by sf package.} + +\item{col}{Numeric attribute to map.} + +\item{buffer}{A buffer, either one value or a vector of 4 values (left, bottom, right, top).} + +\item{n}{The desire number of classes.} + +\item{style}{Method to process the color scale for continuous numerical variables. See `classInt::classIntervals()` for details.} + +\item{palette}{Vector of fill colors as hexadecimal values. For REACH color palettes, it is possible to use `pal_reach()`. For now,'palette' must be changed manually, accordingly to the number of drawn classes.} + +\item{as_count}{Boolean. When col is a numeric variable, should it be processed as a count variable? For instance, 0, 1-10, 11-20.} + +\item{color_na}{Fill color for missing data.} + +\item{text_na}{Legend text for missing data.} + +\item{legend_title}{Legend title.} + +\item{legend_text_separator}{Text separator for classes. E.g. " to " will give 0, 1 to 10, 11 to 20.} + +\item{border_alpha}{Transparency of the border.} + +\item{border_col}{Color of the border.} + +\item{lwd}{Linewidth of the border.} + +\item{...}{Other arguments to pass to `tmap::tm_polygons()`.} +} +\value{ +A tmap layer. +} +\description{ +Wrapper around `tmap::tm_polygons()` with sane defaults for plotting indicator values +} diff --git a/man/add_layout.Rd b/man/add_layout.Rd new file mode 100644 index 0000000..f5c4b53 --- /dev/null +++ b/man/add_layout.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_layout} +\alias{add_layout} +\title{Basic defaults based on `tmap::tm_layout()`} +\usage{ +add_layout( + title = NULL, + legend_position = c(0.02, 0.5), + frame = FALSE, + legend_frame = cols_reach("main_grey"), + legend_text_size = 0.6, + legend_title_size = 0.8, + title_size = 0.9, + title_fontface = "bold", + title_color = cols_reach("main_grey"), + fontfamily = "Leelawadee", + ... +) +} +\arguments{ +\item{title}{Map title.} + +\item{legend_position}{Legend position. Not above the map is a good start.} + +\item{frame}{Boolean. Legend frame?} + +\item{legend_frame}{Legend frame color.} + +\item{legend_text_size}{Legend text size in 'pt'.} + +\item{legend_title_size}{Legend title size in 'pt'.} + +\item{title_size}{Title text size in 'pt'.} + +\item{title_fontface}{Title fontface. Bold if you wanna exemplify a lot what it is about.} + +\item{title_color}{Title font color.} + +\item{fontfamily}{Overall fontfamily. Leelawadee is your precious.} + +\item{...}{Other arguments to pass to `tmap::tm_layout()`.} +} +\value{ +A tmap layer. +} +\description{ +Basic defaults based on `tmap::tm_layout()` +} diff --git a/man/add_scale_bar.Rd b/man/add_scale_bar.Rd new file mode 100644 index 0000000..b204c3c --- /dev/null +++ b/man/add_scale_bar.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/map.R +\name{add_scale_bar} +\alias{add_scale_bar} +\title{Add a scale bar} +\usage{ +add_scale_bar( + text_size = 0.6, + position = c("left", 0.01), + color_dark = cols_reach("black"), + breaks = c(0, 50, 100), + ... +) +} +\arguments{ +\item{text_size}{Relative font size.} + +\item{position}{Position of the compass. Vector of two values, specifying the x and y coordinates.} + +\item{color_dark}{Color of the dark parts of the compass.} + +\item{breaks}{Breaks of the scale bar. If not specified, breaks will be automatically be chosen given the prefered width of the scale bar. Example: c(0, 50, 100).} + +\item{...}{Other arguments to pass to `tmap::tm_compass()`.} +} +\value{ +A tmap layer. +} +\description{ +Add a scale bar +} diff --git a/man/alluvial.Rd b/man/alluvial.Rd new file mode 100644 index 0000000..8750fe9 --- /dev/null +++ b/man/alluvial.Rd @@ -0,0 +1,64 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/alluvial.R +\name{alluvial} +\alias{alluvial} +\title{Simple alluvial chart} +\usage{ +alluvial( + df, + from, + to, + value, + group = NULL, + alpha = 0.5, + from_levels = NULL, + value_title = NULL, + group_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + rect_color = cols_reach("white"), + rect_border_color = cols_reach("main_grey"), + rect_text_color = cols_reach("main_grey"), + theme = theme_reach(axis_y = FALSE, legend_position = "none") +) +} +\arguments{ +\item{df}{A data frame.} + +\item{from}{A character column of upstream stratum.} + +\item{to}{A character column of downstream stratum.} + +\item{value}{A numeric column of values.} + +\item{group}{The grouping column to fill the alluvium with.} + +\item{alpha}{Fill transparency. Default to 0.5.} + +\item{from_levels}{Order by given from levels?} + +\item{value_title}{The value/y scale title. Default to NULL.} + +\item{group_title}{The group title. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{rect_color}{Stratum rectangles' fill color.} + +\item{rect_border_color}{Stratum rectangles' border color.} + +\item{rect_text_color}{Stratum rectangles' text color.} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A donut chart to be used parsimoniously +} +\description{ +Simple alluvial chart +} diff --git a/man/bar.Rd b/man/bar.Rd new file mode 100644 index 0000000..7dc2f19 --- /dev/null +++ b/man/bar.Rd @@ -0,0 +1,70 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bar.R +\name{bar} +\alias{bar} +\title{Simple bar chart} +\usage{ +bar( + df, + x, + y, + group = NULL, + flip = TRUE, + percent = TRUE, + wrap = NULL, + position = "dodge", + alpha = 1, + x_title = NULL, + y_title = NULL, + group_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + add_text = FALSE, + add_text_suffix = "", + theme = theme_reach() +) +} +\arguments{ +\item{df}{A data frame.} + +\item{x}{A numeric column.} + +\item{y}{A character column or coercible as a character column.} + +\item{group}{Some grouping categorical column, e.g. administrative areas or population groups.} + +\item{flip}{TRUE or FALSE. Default to TRUE or horizontal bar plot.} + +\item{percent}{TRUE or FALSE. Should the x-labels (and text labels if present) be displayed as percentages? Default to TRUE.} + +\item{wrap}{Should x-labels be wrapped? Number of characters.} + +\item{position}{Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack".} + +\item{alpha}{Fill transparency.} + +\item{x_title}{The x scale title. Default to NULL.} + +\item{y_title}{The y scale title. Default to NULL.} + +\item{group_title}{The group legend title. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{add_text}{TRUE or FALSE. Add the value as text.} + +\item{add_text_suffix}{If percent is FALSE, should we add a suffix to the text label?} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A bar chart +} +\description{ +Simple bar chart +} diff --git a/man/border_admin0.Rd b/man/border_admin0.Rd new file mode 100644 index 0000000..cd495f3 --- /dev/null +++ b/man/border_admin0.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{border_admin0} +\alias{border_admin0} +\title{Haïti border.} +\format{ +A sf multiline objet with 1 feature and 6 fields: +\describe{ + \item{fid_1}{fid_1} + \item{uno}{uno} + \item{count}{count} + \item{x_coord}{x_coord} + \item{y_coord}{y_coord} + \item{area}{area} + \item{geometry}{Multiline geometry.} +} +} +\usage{ +border_admin0 +} +\description{ +A multiline shapefile of Haiti's border. +} +\keyword{datasets} diff --git a/man/buffer_bbox.Rd b/man/buffer_bbox.Rd new file mode 100644 index 0000000..066562f --- /dev/null +++ b/man/buffer_bbox.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bbox_buffer.R +\name{buffer_bbox} +\alias{buffer_bbox} +\title{Bbbox buffer} +\usage{ +buffer_bbox(sf_obj, buffer = 0) +} +\arguments{ +\item{sf_obj}{A `sf` object} + +\item{buffer}{A buffer, either one value or a vector of 4 values (left, bottom, right, top). Default to 0.} +} +\value{ +A bbox with a buffer +} +\description{ +Bbbox buffer +} diff --git a/man/centroid_admin1.Rd b/man/centroid_admin1.Rd new file mode 100644 index 0000000..c221ac9 --- /dev/null +++ b/man/centroid_admin1.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{centroid_admin1} +\alias{centroid_admin1} +\title{Haïti admin 1 centroids shapefile.} +\format{ +A sf multipoint object with 10 features and 9 fields: +\describe{ + \item{ADM1_PC}{Admin 1 postal code.} + \item{ADM1_EN}{Full name in English.} + \item{ADM1_FR}{Full name in French.} + \item{ADM1_HT}{Full name in Haitian Creole.} + \item{ADM0_EN}{Country name in English.} + \item{ADM0_FR}{Country name in French.} + \item{ADM0_HT}{Country name in Haitian Creole.} + \item{ADM0_PC}{Country postal code.} + \item{ADM1_FR_UPPER}{Admin 1 French name - uppercase.} + \item{geometry}{Multipoint geometry.} +} +} +\usage{ +centroid_admin1 +} +\description{ +A multipoint shapefile of Haiti's admin 1. +} +\keyword{datasets} diff --git a/man/cols_impact.Rd b/man/cols_impact.Rd new file mode 100644 index 0000000..9833a64 --- /dev/null +++ b/man/cols_impact.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cols_impact.R +\name{cols_impact} +\alias{cols_impact} +\title{Function to extract IMPACT colors as hex codes} +\usage{ +cols_impact(..., unnamed = TRUE) +} +\arguments{ +\item{...}{Character names of reach colors. If NULL returns all colors} + +\item{unnamed}{Should the output vector be unnamed? Default to `TRUE`} +} +\value{ +An hex code or hex codes named or unnamed +} +\description{ +Function to extract IMPACT colors as hex codes +} +\details{ +This function needs to be modified to add colors +} diff --git a/man/donut.Rd b/man/donut.Rd new file mode 100644 index 0000000..b461123 --- /dev/null +++ b/man/donut.Rd @@ -0,0 +1,61 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/donut.R +\name{donut} +\alias{donut} +\title{Simple donut chart (to be used parsimoniously), can be a pie chart} +\usage{ +donut( + df, + x, + y, + alpha = 1, + x_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + arrange = TRUE, + hole_size = 3, + add_text = TRUE, + add_text_treshold_display = 5, + add_text_color = "white", + add_text_suffix = "", + theme = theme_reach(legend_reverse = TRUE) +) +} +\arguments{ +\item{df}{A data frame.} + +\item{x}{A character column or coercible as a character column. Will give the donut's fill color.} + +\item{y}{A numeric column.} + +\item{alpha}{Fill transparency.} + +\item{x_title}{The x scale title. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{arrange}{TRUE or FALSE. Arrange by highest percentage first.} + +\item{hole_size}{Hole size. Default to 3. If less than 2, back to a pie chart.} + +\item{add_text}{TRUE or FALSE. Add the value as text.} + +\item{add_text_treshold_display}{Minimum value to add the text label.} + +\item{add_text_color}{Text color.} + +\item{add_text_suffix}{If percent is FALSE, should we add a suffix to the text label?} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A donut chart to be used parsimoniously +} +\description{ +Simple donut chart (to be used parsimoniously), can be a pie chart +} diff --git a/man/dumbbell.Rd b/man/dumbbell.Rd new file mode 100644 index 0000000..2bd7437 --- /dev/null +++ b/man/dumbbell.Rd @@ -0,0 +1,85 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dumbbell.R +\name{dumbbell} +\alias{dumbbell} +\title{Make dumbbell chart.} +\usage{ +dumbbell( + df, + col, + group_x, + group_y, + point_size = 5, + point_alpha = 1, + segment_size = 2.5, + segment_color = cols_reach("main_lt_grey"), + group_x_title = NULL, + group_y_title = NULL, + x_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + line_to_y_axis = TRUE, + line_to_y_axis_type = 3, + line_to_y_axis_width = 0.5, + line_to_y_axis_color = cols_reach("main_grey"), + add_text = TRUE, + add_text_vjust = 2, + add_text_size = 3.5, + add_text_color = cols_reach("main_grey"), + theme = theme_reach(palette = "primary") +) +} +\arguments{ +\item{df}{A data frame.} + +\item{col}{A numeric column.} + +\item{group_x}{The grouping column on the x-axis; only two groups.} + +\item{group_y}{The grouping column on the y-axis.} + +\item{point_size}{Point size.} + +\item{point_alpha}{Point alpha.} + +\item{segment_size}{Segment size.} + +\item{segment_color}{Segment color.} + +\item{group_x_title}{X-group and legend title.} + +\item{group_y_title}{Y-axis and group title.} + +\item{x_title}{X-axis title.} + +\item{title}{Title.} + +\item{subtitle}{Subtitle.} + +\item{caption}{Caption.} + +\item{line_to_y_axis}{TRUE or FALSE; add a line connected points and Y-axis.} + +\item{line_to_y_axis_type}{Line to Y-axis type.} + +\item{line_to_y_axis_width}{Line to Y-axis width.} + +\item{line_to_y_axis_color}{Line to Y-axis color.} + +\item{add_text}{TRUE or FALSE; add text at the points.} + +\item{add_text_vjust}{Vertical adjustment.} + +\item{add_text_size}{Text size.} + +\item{add_text_color}{Text color.} + +\item{theme}{A ggplot2 theme, default to `theme_reach()`} +} +\value{ +A dumbbell chart. +} +\description{ +Make dumbbell chart. +} diff --git a/man/figures/README-example-alluvial-plot-1.png b/man/figures/README-example-alluvial-plot-1.png new file mode 100644 index 0000000..33a0499 Binary files /dev/null and b/man/figures/README-example-alluvial-plot-1.png differ diff --git a/man/figures/README-example-bar-chart-1.png b/man/figures/README-example-bar-chart-1.png new file mode 100644 index 0000000..cc3c997 Binary files /dev/null and b/man/figures/README-example-bar-chart-1.png differ diff --git a/man/figures/README-example-bar-chart-2.png b/man/figures/README-example-bar-chart-2.png new file mode 100644 index 0000000..e5cbaad Binary files /dev/null and b/man/figures/README-example-bar-chart-2.png differ diff --git a/man/figures/README-example-bar-chart-3.png b/man/figures/README-example-bar-chart-3.png new file mode 100644 index 0000000..f4b8b7e Binary files /dev/null and b/man/figures/README-example-bar-chart-3.png differ diff --git a/man/figures/README-example-donut-plot-1.png b/man/figures/README-example-donut-plot-1.png new file mode 100644 index 0000000..d30c943 Binary files /dev/null and b/man/figures/README-example-donut-plot-1.png differ diff --git a/man/figures/README-example-dumbbell-plot-1.png b/man/figures/README-example-dumbbell-plot-1.png new file mode 100644 index 0000000..06ead24 Binary files /dev/null and b/man/figures/README-example-dumbbell-plot-1.png differ diff --git a/man/figures/README-example-lollipop-chart-1.png b/man/figures/README-example-lollipop-chart-1.png new file mode 100644 index 0000000..0decaf1 Binary files /dev/null and b/man/figures/README-example-lollipop-chart-1.png differ diff --git a/man/figures/README-example-lollipop-chart-2.png b/man/figures/README-example-lollipop-chart-2.png new file mode 100644 index 0000000..0897e8e Binary files /dev/null and b/man/figures/README-example-lollipop-chart-2.png differ diff --git a/man/figures/README-example-map.png b/man/figures/README-example-map.png new file mode 100644 index 0000000..3e671f9 Binary files /dev/null and b/man/figures/README-example-map.png differ diff --git a/man/figures/README-example-map.svg b/man/figures/README-example-map.svg new file mode 100644 index 0000000..5e389c0 --- /dev/null +++ b/man/figures/README-example-map.svg @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ARTIBONITE +NORD-OUEST +NORD +NORD-EST +OUEST +SUD-EST +SUD +GRANDE'ANSE +NIPPES +CENTRE +ARTIBONITE +NORD-OUEST +NORD +NORD-EST +OUEST +SUD-EST +SUD +GRANDE'ANSE +NIPPES +CENTRE +% of HH that reported open defecation as sanitation facility +Admin. boundaries. : CNIGS +Coord. system: GCS WGS 1984 + + +0 +50 +100 +km + + + + + + + + +N + + + +Proportion (%) + + + + + + + + + + +11 - 20 +21 - 30 +31 - 40 +41 - 50 +51 - 60 +Missing data + + + + + + + + +Administrative boundaries + + + + + + + +Department +Country +Dominican Rep. frontier + + + + + + diff --git a/man/figures/README-example-point-chart-1.png b/man/figures/README-example-point-chart-1.png new file mode 100644 index 0000000..f705a3d Binary files /dev/null and b/man/figures/README-example-point-chart-1.png differ diff --git a/man/figures/README-example-point-chart-2.png b/man/figures/README-example-point-chart-2.png new file mode 100644 index 0000000..76ef877 Binary files /dev/null and b/man/figures/README-example-point-chart-2.png differ diff --git a/man/figures/README-example-point-chart-3.png b/man/figures/README-example-point-chart-3.png new file mode 100644 index 0000000..b32aa89 Binary files /dev/null and b/man/figures/README-example-point-chart-3.png differ diff --git a/man/figures/README-example-waffke-plot-1.png b/man/figures/README-example-waffke-plot-1.png new file mode 100644 index 0000000..a750983 Binary files /dev/null and b/man/figures/README-example-waffke-plot-1.png differ diff --git a/man/figures/README-example-waffle-plot-1.png b/man/figures/README-example-waffle-plot-1.png new file mode 100644 index 0000000..0183c5a Binary files /dev/null and b/man/figures/README-example-waffle-plot-1.png differ diff --git a/man/figures/logo.png b/man/figures/logo.png index 145688b..2945afe 100644 Binary files a/man/figures/logo.png and b/man/figures/logo.png differ diff --git a/man/frontier_admin0.Rd b/man/frontier_admin0.Rd new file mode 100644 index 0000000..91501c1 --- /dev/null +++ b/man/frontier_admin0.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{frontier_admin0} +\alias{frontier_admin0} +\title{Haïti frontier with Dominican Republic.} +\format{ +A sf multipoint objet with 4 features and 8 fields: +\describe{ + \item{fid_1}{fid_1} + \item{objectid}{objectid} + \item{id}{id} + \item{fromnode}{fromnode} + \item{tonode}{tonode} + \item{leftpolygo}{leftpolygo} + \item{rightpolygo}{rightpolygo} + \item{shape_leng}{shape_leng} + \item{geometry}{Multiline geometry.} +} +} +\usage{ +frontier_admin0 +} +\description{ +A multiline shapefile of Haiti's frontier with Dominican Republic. +} +\keyword{datasets} diff --git a/man/if_not_in_stop.Rd b/man/if_not_in_stop.Rd new file mode 100644 index 0000000..bb29dea --- /dev/null +++ b/man/if_not_in_stop.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internals.R +\name{if_not_in_stop} +\alias{if_not_in_stop} +\title{Stop statement "If not in colnames" with colnames} +\usage{ +if_not_in_stop(.tbl, cols, df, arg = NULL) +} +\arguments{ +\item{.tbl}{A tibble} + +\item{cols}{A vector of column names (quoted)} + +\item{df}{Provide the tibble name as a character string} + +\item{arg}{Default to NULL.} +} +\value{ +A stop statement +} +\description{ +Stop statement "If not in colnames" with colnames +} diff --git a/man/if_vec_not_in_stop.Rd b/man/if_vec_not_in_stop.Rd new file mode 100644 index 0000000..56d228f --- /dev/null +++ b/man/if_vec_not_in_stop.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internals.R +\name{if_vec_not_in_stop} +\alias{if_vec_not_in_stop} +\title{Stop statement "If not in vector"} +\usage{ +if_vec_not_in_stop(vec, cols, vec_name, arg = NULL) +} +\arguments{ +\item{vec}{A vector of character strings} + +\item{cols}{A set of character strings} + +\item{vec_name}{Provide the vector name as a character string} + +\item{arg}{Default to NULL.} +} +\value{ +A stop statement if some elements of vec are not in cols +} +\description{ +Stop statement "If not in vector" +} diff --git a/man/indicator_admin1.Rd b/man/indicator_admin1.Rd new file mode 100644 index 0000000..673ee1b --- /dev/null +++ b/man/indicator_admin1.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{indicator_admin1} +\alias{indicator_admin1} +\title{Indicator admin 1 polygons shapefile.} +\format{ +A sf multipoint object with 10 features and 10 fields: +\describe{ + \item{ADM1_PC}{Admin 1 postal code.} + \item{admin1}{Admin 1 unique id.} + \item{opn_dfc}{Proportion of HHs that reported open defecation as sanitation facility.} + \item{ADM1_EN}{Full name in English.} + \item{ADM1_FR}{Full name in French.} + \item{ADM1_HT}{Full name in Haitian Creole.} + \item{ADM0_EN}{Country name in English.} + \item{ADM0_FR}{Country name in French.} + \item{ADM0_HT}{Country name in Haitian Creole.} + \item{ADM0_PC}{Country postal code.} + \item{geometry}{Multipolygon geometry.} +} +} +\usage{ +indicator_admin1 +} +\description{ +A multipolygon shapefile of Haiti's admin 1 with an indicator column 'opn_dfc'. +} +\keyword{datasets} diff --git a/man/line_admin1.Rd b/man/line_admin1.Rd new file mode 100644 index 0000000..49f72e4 --- /dev/null +++ b/man/line_admin1.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{line_admin1} +\alias{line_admin1} +\title{Haïti admin 1 lines shapefile.} +\format{ +A sf multiline object with 10 features and 8 fields: +\describe{ + \item{ADM1_EN}{Full name in English.} + \item{ADM1_FR}{Full name in French.} + \item{ADM1_HT}{Full name in Haitian Creole.} + \item{ADM0_EN}{Country name in English.} + \item{ADM0_FR}{Country name in French.} + \item{ADM0_HT}{Country name in Haitian Creole.} + \item{ADM0_PCODE}{Country postal code.} + \item{geometry}{Multiline geometry.} +} +} +\usage{ +line_admin1 +} +\description{ +A multiline shapefile of Haiti's admin 1. +} +\keyword{datasets} diff --git a/man/lollipop.Rd b/man/lollipop.Rd new file mode 100644 index 0000000..6bc23ef --- /dev/null +++ b/man/lollipop.Rd @@ -0,0 +1,88 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/lollipop.R +\name{lollipop} +\alias{lollipop} +\title{Simple bar chart} +\usage{ +lollipop( + df, + x, + y, + flip = TRUE, + wrap = NULL, + arrange = TRUE, + point_size = 3, + point_color = cols_reach("main_red"), + point_alpha = 1, + segment_size = 1, + segment_color = cols_reach("main_grey"), + segment_alpha = 1, + alpha = 1, + x_title = NULL, + y_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + add_text = FALSE, + add_text_size = 3, + add_text_suffix = "", + add_text_color = "white", + add_text_fontface = "bold", + theme = theme_reach() +) +} +\arguments{ +\item{df}{A data frame.} + +\item{x}{A numeric column.} + +\item{y}{A character column or coercible as a character column.} + +\item{flip}{TRUE or FALSE. Default to TRUE or horizontal lollipop plot.} + +\item{wrap}{Should x-labels be wrapped? Number of characters.} + +\item{arrange}{TRUE or FALSE. Arrange by highest percentage first.} + +\item{point_size}{Point size.} + +\item{point_color}{Point color.} + +\item{point_alpha}{Point alpha.} + +\item{segment_size}{Segment size.} + +\item{segment_color}{Segment color.} + +\item{segment_alpha}{Segment alpha.} + +\item{alpha}{Fill transparency.} + +\item{x_title}{The x scale title. Default to NULL.} + +\item{y_title}{The y scale title. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{add_text}{TRUE or FALSE. Add the y value as text within the bubble.} + +\item{add_text_size}{Text size.} + +\item{add_text_suffix}{If percent is FALSE, should we add a suffix to the text label?} + +\item{add_text_color}{Added text color. Default to white.} + +\item{add_text_fontface}{Added text font face. Default to "bold".} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A bar chart +} +\description{ +Simple bar chart +} diff --git a/man/pal_fallback.Rd b/man/pal_fallback.Rd new file mode 100644 index 0000000..6716ae5 --- /dev/null +++ b/man/pal_fallback.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pal_fallback.R +\name{pal_fallback} +\alias{pal_fallback} +\title{Return function to interpolate a fallback palette base on viridis::magma()} +\usage{ +pal_fallback( + reverse = FALSE, + color_ramp_palette = FALSE, + discrete = FALSE, + n = 5, + ... +) +} +\arguments{ +\item{reverse}{Boolean indicating whether the palette should be reversed} + +\item{color_ramp_palette}{Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the latter with `FALSE`} + +\item{discrete}{Boolean. Discrete or not? Default to FALSE.} + +\item{n}{Number of colors in the palette. Default to 5. Passe to `viridis::magma()`} + +\item{...}{Other parameters to pass to `grDevices::colorRampPalette()`} +} +\value{ +A color palette +} +\description{ +Return function to interpolate a fallback palette base on viridis::magma() +} diff --git a/man/pal_impact.Rd b/man/pal_impact.Rd new file mode 100644 index 0000000..a3a16a2 --- /dev/null +++ b/man/pal_impact.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/pal_impact.R +\name{pal_impact} +\alias{pal_impact} +\title{Return function to interpolate an IMPACT color palette} +\usage{ +pal_impact( + palette = "main", + reverse = FALSE, + color_ramp_palette = FALSE, + show_palettes = FALSE, + ... +) +} +\arguments{ +\item{palette}{Character name of a palette in IMPACT palettes} + +\item{reverse}{Boolean indicating whether the palette should be reversed} + +\item{color_ramp_palette}{Should the output be a `grDevices::colorRampPalette` function or a vector of hex codes? Default to the former with `TRUE`} + +\item{show_palettes}{Should the ouput be the set of palettes names to pick from? Default to `FALSE`} + +\item{...}{Additional arguments to pass to colorRampPalette()} +} +\value{ +A color palette +} +\description{ +Return function to interpolate an IMPACT color palette +} diff --git a/man/point.Rd b/man/point.Rd new file mode 100644 index 0000000..fd2d5d0 --- /dev/null +++ b/man/point.Rd @@ -0,0 +1,58 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/point.R +\name{point} +\alias{point} +\title{Simple point chart} +\usage{ +point( + df, + x, + y, + group = NULL, + flip = TRUE, + alpha = 1, + size = 1, + x_title = NULL, + y_title = NULL, + group_title = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + theme = theme_reach() +) +} +\arguments{ +\item{df}{A data frame.} + +\item{x}{A numeric column.} + +\item{y}{A character column or coercible as a character column.} + +\item{group}{Some grouping categorical column, e.g. administrative areas or population groups.} + +\item{flip}{TRUE or FALSE. Default to TRUE or horizontal bar plot.} + +\item{alpha}{Fill transparency.} + +\item{size}{Point size.} + +\item{x_title}{The x scale title. Default to NULL.} + +\item{y_title}{The y scale title. Default to NULL.} + +\item{group_title}{The group legend title. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A bar chart +} +\description{ +Simple point chart +} diff --git a/man/scale_color.Rd b/man/scale_color.Rd index adc0cfc..ab17204 100644 --- a/man/scale_color.Rd +++ b/man/scale_color.Rd @@ -9,36 +9,27 @@ scale_color( palette = "main", discrete = TRUE, reverse = FALSE, - ... -) - -scale_color( - initiative = "reach", - palette = "main", - discrete = TRUE, - reverse = FALSE, + reverse_guide = TRUE, ... ) } \arguments{ -\item{initiative}{Either "reach" or "agora} +\item{initiative}{Either "reach" or "agora" or "default".} -\item{palette}{Character name of palette in drsimonj_palettes} +\item{palette}{Palette name from `pal_reach()` or `pal_agora()`.} -\item{discrete}{Boolean indicating whether color aesthetic is discrete or not} +\item{discrete}{Boolean indicating whether color aesthetic is discrete or not.} -\item{reverse}{Boolean indicating whether the palette should be reversed} +\item{reverse}{Boolean indicating whether the palette should be reversed.} + +\item{reverse_guide}{Boolean indicating whether the guide should be reversed.} \item{...}{Additional arguments passed to discrete_scale() or -scale_fill_gradientn(), used respectively when discrete is TRUE or FALSE} +scale_fill_gradient(), used respectively when discrete is TRUE or FALSE.} } \value{ A color scale for ggplot - -A fill scale for ggplot } \description{ Color scale constructor for REACH or AGORA colors - -Fill scale constructor for REACH or AGORA colors } diff --git a/man/scale_fill.Rd b/man/scale_fill.Rd new file mode 100644 index 0000000..95d3dc3 --- /dev/null +++ b/man/scale_fill.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/scale.R +\name{scale_fill} +\alias{scale_fill} +\title{Fill scale constructor for REACH or AGORA colors} +\usage{ +scale_fill( + initiative = "reach", + palette = "main", + discrete = TRUE, + reverse = FALSE, + reverse_guide = TRUE, + ... +) +} +\arguments{ +\item{initiative}{Either "reach" or "agora" or "default".} + +\item{palette}{Palette name from `pal_reach()` or `pal_agora()`.} + +\item{discrete}{Boolean indicating whether color aesthetic is discrete or not.} + +\item{reverse}{Boolean indicating whether the palette should be reversed.} + +\item{reverse_guide}{Boolean indicating whether the guide should be reversed.} + +\item{...}{Additional arguments passed to discrete_scale() or +scale_fill_gradient(), used respectively when discrete is TRUE or FALSE.} +} +\value{ +A fill scale for ggplot. +} +\description{ +Fill scale constructor for REACH or AGORA colors +} diff --git a/man/subvec_not_in.Rd b/man/subvec_not_in.Rd new file mode 100644 index 0000000..90d4d58 --- /dev/null +++ b/man/subvec_not_in.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internals.R +\name{subvec_not_in} +\alias{subvec_not_in} +\title{Subvec not in} +\usage{ +subvec_not_in(vector, set) +} +\arguments{ +\item{vector}{A vector to subset} + +\item{set}{A set-vector} +} +\value{ +A subset of vector not in set +} +\description{ +Subvec not in +} diff --git a/man/theme_reach.Rd b/man/theme_reach.Rd index 7c760db..8718dc6 100644 --- a/man/theme_reach.Rd +++ b/man/theme_reach.Rd @@ -2,16 +2,159 @@ % Please edit documentation in R/theme_reach.R \name{theme_reach} \alias{theme_reach} -\title{Base REACH ggplot2 theme} +\title{ggplot2 theme with REACH color palettes} \usage{ -theme_reach(family = "Leelawadee") +theme_reach( + initiative = "reach", + palette = "main", + discrete = TRUE, + reverse = FALSE, + font_family = "Segoe UI", + title_size = 12, + title_color = cols_reach("main_grey"), + title_font_face = "bold", + title_hjust = NULL, + title_position_to_plot = TRUE, + text_size = 10, + text_color = cols_reach("main_grey"), + text_font_face = "plain", + panel_background_color = "#FFFFFF", + panel_border = FALSE, + panel_border_color = cols_reach("main_grey"), + legend_position = "right", + legend_direction = "vertical", + legend_reverse = TRUE, + legend_title_size = 11, + legend_title_color = cols_reach("main_grey"), + legend_title_font_face = "plain", + legend_text_size = 10, + legend_text_color = cols_reach("main_grey"), + legend_text_font_face = "plain", + axis_x = TRUE, + axis_y = TRUE, + axis_text_size = 10, + axis_text_color = cols_reach("main_grey"), + axis_text_font_face = "plain", + axis_title_size = 11, + axis_title_color = cols_reach("main_grey"), + axis_title_font_face = "bold", + axis_text_x_angle = 0, + axis_text_x_vjust = 0.5, + axis_text_x_hjust = 0.5, + grid_major_x = FALSE, + grid_major_y = FALSE, + grid_major_color = cols_reach("main_lt_grey"), + grid_major_x_size = 0.1, + grid_major_y_size = 0.1, + grid_minor_x = FALSE, + grid_minor_y = FALSE, + grid_minor_color = cols_reach("main_lt_grey"), + grid_minor_x_size = 0.05, + grid_minor_y_size = 0.05, + caption_position_to_plot = TRUE, + ... +) } \arguments{ -\item{family}{The font family. Default to "Leelawadee"} +\item{initiative}{Either "reach" or "default".} + +\item{palette}{Palette name from 'pal_reach()'.} + +\item{discrete}{Boolean indicating whether color aesthetic is discrete or not.} + +\item{reverse}{Boolean indicating whether the palette should be reversed.} + +\item{font_family}{The font family for all plot's texts. Default to "Segoe UI".} + +\item{title_size}{The size of the legend title. Defaults to 11.} + +\item{title_color}{Legend title color.} + +\item{title_font_face}{Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{title_hjust}{Title horizontal justification. Default to NULL. Use 0.5 to center the title.} + +\item{title_position_to_plot}{TRUE or FALSE. Positioning to plot or to panel?} + +\item{text_size}{The size of all text other than the title, subtitle and caption. Defaults to 10.} + +\item{text_color}{Text color.} + +\item{text_font_face}{Text font face. Default to "bold". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{panel_background_color}{The color for the panel background color. Default to white.} + +\item{panel_border}{Boolean. Plot a panel border? Default to FALSE.} + +\item{panel_border_color}{A color. Default to REACH main grey.} + +\item{legend_position}{Position of the legend; Default to "right". Can take "right", "left", "top", "bottom" or "none".} + +\item{legend_direction}{Direction of the legend. Default to "vertical". Can take "vertical" or "horizontal".} + +\item{legend_reverse}{Reverse the color in the guide? Default to TRUE.} + +\item{legend_title_size}{Legend title size.} + +\item{legend_title_color}{Legend title color.} + +\item{legend_title_font_face}{Legend title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{legend_text_size}{Legend text size.} + +\item{legend_text_color}{Legend text color.} + +\item{legend_text_font_face}{Legend text font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{axis_x}{Boolean. Do you need x-axis?} + +\item{axis_y}{Boolean. Do you need y-axis?} + +\item{axis_text_size}{Axis text size.} + +\item{axis_text_color}{Axis text color.} + +\item{axis_text_font_face}{Axis text font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{axis_title_size}{Axis title size.} + +\item{axis_title_color}{Axis title color.} + +\item{axis_title_font_face}{Axis title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic").} + +\item{axis_text_x_angle}{Angle for the x-axis text.} + +\item{axis_text_x_vjust}{Vertical adjustment for the x-axis text.} + +\item{axis_text_x_hjust}{Vertical adjustment for the x-axis text.} + +\item{grid_major_x}{Boolean. Do you need major grid lines for x-axis?} + +\item{grid_major_y}{Boolean. Do you need major grid lines for y-axis?} + +\item{grid_major_color}{Major grid lines color.} + +\item{grid_major_x_size}{Major X line size.} + +\item{grid_major_y_size}{Major Y line size.} + +\item{grid_minor_x}{Boolean. Do you need minor grid lines for x-axis?} + +\item{grid_minor_y}{Boolean. Do you need minor grid lines for y-axis?} + +\item{grid_minor_color}{Minor grid lines color.} + +\item{grid_minor_x_size}{Minor X line size.} + +\item{grid_minor_y_size}{Minor Y line size.} + +\item{caption_position_to_plot}{TRUE or FALSE. Positioning to plot or to panel?} + +\item{...}{Additional arguments passed to `ggplot2::gg_theme()`.} } \value{ The base REACH theme } \description{ -Give some reach colors and fonts to a ggplot. Based on theme_bw() +Give some reach colors and fonts to a ggplot. } diff --git a/man/theme_reach_borders.Rd b/man/theme_reach_borders.Rd deleted file mode 100644 index c6cc1b6..0000000 --- a/man/theme_reach_borders.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/theme_reach.R -\name{theme_reach_borders} -\alias{theme_reach_borders} -\title{Some REACH theme for ggplot} -\usage{ -theme_reach_borders(family = "Leelawadee") -} -\arguments{ -\item{family}{The font family. Default to "Leelawadee"} -} -\value{ -A theme to be added to the "+" ggplot grammar -} -\description{ -Some REACH theme for ggplot -} diff --git a/man/theme_reach_flip_hist.Rd b/man/theme_reach_flip_hist.Rd deleted file mode 100644 index a23c795..0000000 --- a/man/theme_reach_flip_hist.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/theme_reach.R -\name{theme_reach_flip_hist} -\alias{theme_reach_flip_hist} -\title{Some reach more minimal theme for ggplot} -\usage{ -theme_reach_flip_hist(family = "Leelawadee") -} -\arguments{ -\item{family}{The font family. Default to "Leelawadee"} -} -\value{ -A theme to be added to the "+" ggplot grammar -} -\description{ -Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for horizontal bar charts. -} diff --git a/man/theme_reach_hist.Rd b/man/theme_reach_hist.Rd deleted file mode 100644 index bb193cd..0000000 --- a/man/theme_reach_hist.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/theme_reach.R -\name{theme_reach_hist} -\alias{theme_reach_hist} -\title{Some reach more minimal theme for ggplot} -\usage{ -theme_reach_hist(family = "Leelawadee") -} -\arguments{ -\item{family}{The font family. Default to "Leelawadee"} -} -\value{ -A theme to be added to the "+" ggplot grammar -} -\description{ -Give some REACH colors and fonts to a ggplot. Based on theme_bw(). To be used for vertical bar charts. -} diff --git a/man/visualizeR-package.Rd b/man/visualizeR-package.Rd new file mode 100644 index 0000000..25e9400 --- /dev/null +++ b/man/visualizeR-package.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/visualizeR-package.R +\docType{package} +\name{visualizeR-package} +\alias{visualizeR} +\alias{visualizeR-package} +\title{visualizeR: What a color! What a viz!} +\description{ +\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} + +It basically provides colors as hex codes, color palettes, and some viz functions (graphs and maps). +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/gnoblet/visualizeR} + \item \url{https://gnoblet.github.io/visualizeR/} +} + +} +\author{ +\strong{Maintainer}: Noblet Guillaume \email{gnoblet@zaclys.net} + +} +\keyword{internal} diff --git a/man/waffle.Rd b/man/waffle.Rd new file mode 100644 index 0000000..a46d9aa --- /dev/null +++ b/man/waffle.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/waffle.R +\name{waffle} +\alias{waffle} +\title{Simple waffle chart} +\usage{ +waffle( + df, + x, + y, + n_rows = 10, + size = 2, + x_title = NULL, + x_lab = NULL, + title = NULL, + subtitle = NULL, + caption = NULL, + arrange = TRUE, + theme = theme_reach(axis_x = FALSE, axis_y = FALSE, legend_position = "bottom", + legend_direction = "horizontal", title_hjust = 0.5) +) +} +\arguments{ +\item{df}{A data frame.} + +\item{x}{A character column or coercible as a character column. Will give the waffle's fill color.} + +\item{y}{A numeric column (if plotting proportion, make sure to have percentages between 0 and 100 and not 0 and 1).} + +\item{n_rows}{Number of rows. Default to 10.} + +\item{size}{Width of the separator between blocks (defaults to 2).} + +\item{x_title}{The x scale title. Default to NULL.} + +\item{x_lab}{The x scale caption. Default to NULL.} + +\item{title}{Plot title. Default to NULL.} + +\item{subtitle}{Plot subtitle. Default to NULL.} + +\item{caption}{Plot caption. Default to NULL.} + +\item{arrange}{TRUE or FALSE. Arrange by highest percentage first.} + +\item{theme}{Whatever theme. Default to theme_reach().} +} +\value{ +A waffle chart +} +\description{ +Simple waffle chart +} diff --git a/visualizeR.Rproj b/visualizeR.Rproj index b9255bc..497f8bf 100644 --- a/visualizeR.Rproj +++ b/visualizeR.Rproj @@ -1,20 +1,20 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source