diff --git a/DESCRIPTION b/DESCRIPTION
index de7e8be..a0f9e60 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: visualizeR
Type: Package
Title: What a color! What a viz!
-Version: 0.1.3.9000
+Version: 0.1.4.9000
Authors@R: c(
person(
'Noblet', 'Guillaume',
@@ -17,7 +17,7 @@ Depends: R (>= 4.1.0)
License: GPL (>= 3)
Encoding: UTF-8
LazyData: true
-RoxygenNote: 7.1.2
+RoxygenNote: 7.2.0
Imports: ggplot2, rlang, grDevices, simplevis, glue, scales
Suggests: knitr, sf
VignetteBuilder: knitr
diff --git a/NEWS.md b/NEWS.md
index b0ebd89..0ab98e1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,9 @@
+# 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.
diff --git a/R/hbar.R b/R/hbar.R
index 7496072..eddd99b 100644
--- a/R/hbar.R
+++ b/R/hbar.R
@@ -12,19 +12,20 @@
#' @param group_title The group legend title. Defaut to NULL
#' @param font_family The font family. Default to "Leelawadee"
#' @param stack Should the chart be stacked? Default to "FALSE" (dodge)
+#' @param reverse Boolean indicating whether the color palette should be reversed
#' @param ... Other arguments to be passed to "simplevis::gg_hbar" or "simplevis:gg_hbar_col"
#'
#' @return A horizontal bar chart
#'
#' @export
-hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", stack = FALSE, ...){
+hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", stack = FALSE, reverse = FALSE, ...){
if (!(initiative %in% c("reach", "agora", "impact"))) rlang::abort(c("Wrong `initiative` arg", "*" = paste0("Arg `initiative` cannot be: ", initiative), "i" = "It must be one of 'reach' or 'agora' or 'impact'"))
- if (initiative == "reach") main_col <- cols_reach("main_grey")
+ if (initiative == "reach") main_col <- pal_reach("main", reverse = reverse)
- if (initiative == "agora") main_col <- cols_agora("main_bordeaux")
+ if (initiative == "agora") main_col <- pal_agora("main", reverse = reverse)
if (initiative == "impact") rlang::abort("IMPACT colors are under development")
@@ -78,19 +79,20 @@ hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", x_title
#' @param group_title The group legend title. Defaut to NULL
#' @param font_family The font family. Default to "Leelawadee"
#' @param stack Should the chart be stacked? Default to "FALSE" (dodge)
+#' @param reverse Boolean indicating whether the color palette should be reversed
#' @param ... Other arguments to be passed to "simplevis::gg_hbar" or "simplevis:gg_hbar_col"
#'
#' @return A horizontal bar chart
#'
#' @export
-hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", stack = FALSE, ...){
+hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", stack = FALSE, reverse = FALSE,...){
if (!(initiative %in% c("reach", "agora", "impact"))) rlang::abort(c("Wrong `initiative` arg", "*" = paste0("Arg `initiative` cannot be: ", initiative), "i" = "It must be one of 'reach' or 'agora' or 'impact'"))
- if (initiative == "reach") main_col <- cols_reach("main_grey")
+ if (initiative == "reach") main_col <- pal_reach("main", reverse = reverse)
- if (initiative == "agora") main_col <- cols_agora("main_bordeaux")
+ if (initiative == "agora") main_col <- pal_agora("main", reverse = reverse)
if (initiative == "impact") rlang::abort("IMPACT colors are under development")
diff --git a/docs/404.html b/docs/404.html
index bc14e9a..a8762fd 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -31,7 +31,7 @@
visualizeR
- 0.1.3.9000
+ 0.1.4.9000
diff --git a/docs/reference/scale_fill.html b/docs/reference/scale_fill.html
index dfc5e6c..e297acf 100644
--- a/docs/reference/scale_fill.html
+++ b/docs/reference/scale_fill.html
@@ -10,7 +10,7 @@
visualizeR
- 0.1.3.9000
+ 0.1.4.9000
@@ -51,32 +51,43 @@
Usage
-
scale_fill(
- initiative = "reach",
- palette = "main",
- discrete = TRUE,
- reverse = FALSE,
- ...
-)
+
scale_fill(
+ initiative = "reach",
+ palette = "main",
+ discrete = TRUE,
+ reverse = FALSE,
+ ...
+)
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
+
+
- ...
Additional arguments passed to discrete_scale() or
scale_fill_gradient(), used respectively when discrete is TRUE or FALSE
+
Value
-
A fill scale for ggplot
+
+
+
A fill scale for ggplot