Update documentation
This commit is contained in:
parent
0198ad53c3
commit
cb9a8bfcac
14 changed files with 243 additions and 220 deletions
6
R/bar.R
6
R/bar.R
|
|
@ -20,7 +20,7 @@
|
|||
#' @param text_size The size of all text other than the title, subtitle and caption. Defaults to 10.
|
||||
#' @param title_size The size of the title text. Defaults to 14.
|
||||
#' @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_rev Reverse the color in the guide? Default to TRUE.
|
||||
#' @param void Boolean to remove all elements from the plot. Default to FALSE.
|
||||
#' @param ... Other arguments to be passed to "ggblanket::gg_col"
|
||||
#'
|
||||
|
|
@ -41,7 +41,7 @@ bar_reach <- function(df, x, y, group = NULL, percent = TRUE, palette = "main",
|
|||
|
||||
if (percent) x_labels <- scales::percent else x_labels <- NULL
|
||||
|
||||
hbar <- df |>
|
||||
pl <- df |>
|
||||
ggblanket::gg_col(x = {{ x }},
|
||||
y = {{ y }},
|
||||
col = {{ group }},
|
||||
|
|
@ -70,5 +70,5 @@ bar_reach <- function(df, x, y, group = NULL, percent = TRUE, palette = "main",
|
|||
...
|
||||
)
|
||||
|
||||
return(hbar)
|
||||
return(pl)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@
|
|||
#' @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 position Should the chart be stacked? Default to "dodge". Can take "dodge" and "stack".
|
||||
#' @param title Plot title. Default to NULL.
|
||||
#' @param subtitle Plot subtitle. Default to NULL.
|
||||
#' @param caption Caption title string. Default to NULL.
|
||||
#' @param text_size The size of all text other than the title, subtitle and caption. Defaults to 10.
|
||||
#' @param title_size The size of the title text. Defaults to 14.
|
||||
#' @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 void Boolean to remove all elements from the plot. Default to FALSE.
|
||||
#' @param ... Other arguments to be passed to "ggblanket::gg_col"
|
||||
#'
|
||||
|
|
@ -38,7 +36,7 @@ point_reach <- function(df, x, y, group = NULL, palette = "main", reverse = FALS
|
|||
)
|
||||
)
|
||||
|
||||
hbar <- df |>
|
||||
pl <- df |>
|
||||
ggblanket::gg_point(x = {{ x }},
|
||||
y = {{ y }},
|
||||
col = {{ group }},
|
||||
|
|
@ -64,5 +62,5 @@ point_reach <- function(df, x, y, group = NULL, palette = "main", reverse = FALS
|
|||
...
|
||||
)
|
||||
|
||||
return(hbar)
|
||||
return(pl)
|
||||
}
|
||||
|
|
|
|||
26
R/scale.R
26
R/scale.R
|
|
@ -1,11 +1,13 @@
|
|||
#' Color scale constructor for REACH or AGORA colors
|
||||
#'
|
||||
#' @param initiative Either "reach" or "agora
|
||||
#' @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 initiative Either "reach" or "agora.
|
||||
#' @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_color_gradient(), used respectively when discrete is TRUE or FALSE
|
||||
#' scale_fill_gradient(), used respectively when discrete is TRUE or FALSE.
|
||||
#'
|
||||
#' @return A color scale for ggplot
|
||||
#'
|
||||
#' @export
|
||||
|
|
@ -59,13 +61,15 @@ scale_color <- function(initiative = "reach", palette = "main", discrete = TRUE
|
|||
|
||||
#' Fill scale constructor for REACH or AGORA colors
|
||||
#'
|
||||
#' @param initiative Either "reach" or "agora
|
||||
#' @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 initiative Either "reach" or "agora.
|
||||
#' @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
|
||||
#' 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, ...) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#' @title ggplot2 theme with REACH color palettes
|
||||
#'
|
||||
#' @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 discrete Boolean indicating whether color aesthetic is discrete or not.
|
||||
#' @param reverse Boolean indicating whether the palette should be reversed.
|
||||
#' @param family The font family for all plot's texts. Default to "Leelawadee".
|
||||
#' @param text_size The size of all text other than the title, subtitle and caption. Defaults to 10.
|
||||
#' @param title_size The size of the title text_family. Defaults to 14.
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#' @param panel_background_pal The color for the panel background color. Default to white.
|
||||
#' @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_reverse Reverse the color in the guide? Default to TRUE.
|
||||
#' @param void Boolean to remove all elements from the plot. Default to FALSE.
|
||||
#' @param ... Additional arguments passed to `ggblanket::gg_theme()`.
|
||||
#'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue