Update pal arg name

This commit is contained in:
gnoblet 2022-07-17 19:20:30 -04:00
parent f2cd5002e5
commit d6d06d67f7
11 changed files with 51 additions and 38 deletions

View file

@ -5,7 +5,7 @@
#' @param y Some column on the y scale
#' @param group Some grouping categorical column, e.g. administrative areas
#' @param initiative Either "reach" or "agora" or "impact" for the color palette
#' @param pal The color palette from the initiative
#' @param palette The color palette from the initiative
#' @param width Width
#' @param x_title The x scale title. Default to empty string
#' @param y_title The y scale title. Default to empty string
@ -21,29 +21,29 @@
#' @return A horizontal bar chart
#'
#' @export
hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", theme = NULL, ...){
hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", palette = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", theme = NULL, ...){
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") {
palette <- pal_reach(pal, reverse = reverse)
palette <- pal_reach(palette, reverse = reverse)
main_col <- cols_reach("main_grey")
if(is.null(palette)) rlang::warn(
c(paste0("There is no palette '", pal, "' for initiative 'reach'. Fallback to ggblanket's default color palette."),
c(paste0("There is no palette '", palette, "' for initiative 'reach'. Fallback to ggblanket's default color palette."),
"i" = paste0("Use `pal_reach(show_palettes = T)` to see the list of availabale palettes.")
)
)
}
if (initiative == "agora") {
palette <- pal_agora(pal, reverse = reverse)
palette <- pal_agora(palette, reverse = reverse)
main_col <- cols_agora("main_bordeaux")
if(is.null(palette)) rlang::warn(
c(paste0("There is no palette '", pal, "' for initiative 'agora'. Fallback to ggblanket's default color palette."),
c(paste0("There is no palette '", palette, "' for initiative 'agora'. Fallback to ggblanket's default color palette."),
"i" = paste0("Use `pal_agora(show_palettes = T)` to see the list of availabale palettes.")
)
)
@ -81,7 +81,7 @@ hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary"
#' @param y Some column on the y scale
#' @param group Some grouping categorical column, e.g. administrative areas
#' @param initiative Either "reach" or "agora" or "impact" for the color palette
#' @param pal The color palette from the initiative
#' @param palette The color palette from the initiative
#' @param width Width
#' @param x_title The x scale title. Default to empty string
#' @param y_title The y scale title. Default to empty string
@ -97,29 +97,29 @@ hbar <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary"
#' @return A horizontal bar chart
#'
#' @export
hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", theme = NULL, ...){
hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", palette = "primary", width = 0.5, x_title = "", y_title = "", group_title = NULL, font_family = "Leelawadee", position = "dodge", reverse = FALSE, title = "", subtitle = "", theme = NULL, ...){
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") {
palette <- pal_reach(pal, reverse = reverse)
palette <- pal_reach(palette, reverse = reverse)
main_col <- cols_reach("main_grey")
if(is.null(palette)) rlang::warn(
c(paste0("There is no palette '", pal, "' for initiative 'reach'. Fallback to ggblanket's default color palette."),
c(paste0("There is no palette '", palette, "' for initiative 'reach'. Fallback to ggblanket's default color palette."),
"i" = paste0("Use `pal_reach(show_palettes = T)` to see the list of availabale palettes.")
)
)
}
if (initiative == "agora") {
palette <- pal_agora(pal, reverse = reverse)
palette <- pal_agora(palette, reverse = reverse)
main_col <- cols_agora("main_bordeaux")
if(is.null(palette)) rlang::warn(
c(paste0("There is no palette '", pal, "' for initiative 'agora'. Fallback to ggblanket's default color palette."),
c(paste0("There is no palette '", palette, "' for initiative 'agora'. Fallback to ggblanket's default color palette."),
"i" = paste0("Use `pal_agora(show_palettes = T)` to see the list of availabale palettes.")
)
)
@ -139,7 +139,7 @@ hbar_percent <- function(.tbl, x, y, group = NULL, initiative = "reach", pal = "
width = width,
x_labels = scales::percent,
position = position,
stat = "identity",
stat = "identity",pkg
title = "",
subtitle = "",
theme = theme,

View file

@ -45,6 +45,7 @@
</div>
<div id="gnu-general-public-license" class="section level1">
<p><em>Version 3, 29 June 2007</em><br><em>Copyright © 2007 Free Software Foundation, Inc. &lt;<a href="http://fsf.org/" class="external-link uri">http://fsf.org/</a>&gt;</em></p>
<p>Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p>
<div class="section level2">

View file

@ -72,7 +72,9 @@
<img src="logo.png" class="logo" alt=""><h1 id="visualizer-">visualizeR <a class="anchor" aria-label="anchor" href="#visualizer-"></a>
</h1>
</div>
<blockquote><p>What a color! What a viz!</p></blockquote>
<blockquote>
<p>What a color! What a viz!</p>
</blockquote>
<p><code>visualizeR</code> proposes some utils to get REACH and AGORA colors, ready-to-go color palettes, and a few visualization functions (horizontal hist graph for instance).</p>
<div class="section level2">
<h2 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
@ -88,17 +90,23 @@
<p>Roadmap is as follows:</p>
<ul class="task-list">
<li>
<input type="checkbox" disabled>Add IMPACTs colors</li>
<input type="checkbox" disabled>
Add IMPACTs colors</li>
<li>
<input type="checkbox" disabled>Add all color palettes from the internal documentation</li>
<input type="checkbox" disabled>
Add all color palettes from the internal documentation</li>
<li>
<input type="checkbox" disabled>Add new types of visualization (e.g. dumbbell plot)</li>
<input type="checkbox" disabled>
Add new types of visualization (e.g. dumbbell plot)</li>
<li>
<input type="checkbox" disabled>Use examples</li>
<input type="checkbox" disabled>
Use examples</li>
<li>
<input type="checkbox" disabled>Add some ease-map functions</li>
<input type="checkbox" disabled>
Add some ease-map functions</li>
<li>
<input type="checkbox" disabled>Add some interactive functions (maps and graphs)</li>
<input type="checkbox" disabled>
Add some interactive functions (maps and graphs)</li>
</ul>
</div>
<div class="section level2">

View file

@ -46,18 +46,22 @@
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.5.9000" id="visualizer-0159000">visualizeR 0.1.5.9000<a class="anchor" aria-label="anchor" href="#visualizer-0159000"></a></h2>
<ul><li>Move from <code>simplevis</code> to successor <code>ggblanket</code>.</li></ul><hr></div>
<ul><li>Move from <code>simplevis</code> to successor <code>ggblanket</code>.</li>
</ul><hr></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.4.9000" id="visualizer-0149000">visualizeR 0.1.4.9000<a class="anchor" aria-label="anchor" href="#visualizer-0149000"></a></h2>
<ul><li>
<code><a href="../reference/hbar.html">hbar()</a></code> gains a new boolean argument <code>reverse</code> to pass to <code><a href="../reference/pal_reach.html">pal_reach()</a></code> or <code><a href="../reference/pal_agora.html">pal_agora()</a></code>, indicating if the color palette should be reversed or not.</li></ul><hr></div>
<code><a href="../reference/hbar.html">hbar()</a></code> gains a new boolean argument <code>reverse</code> to pass to <code><a href="../reference/pal_reach.html">pal_reach()</a></code> or <code><a href="../reference/pal_agora.html">pal_agora()</a></code>, indicating if the color palette should be reversed or not.</li>
</ul><hr></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.3.9000" id="visualizer-0139000">visualizeR 0.1.3.9000<a class="anchor" aria-label="anchor" href="#visualizer-0139000"></a></h2>
<ul><li>Small change to <code><a href="../reference/hbar.html">hbar()</a></code>: removes error arg within <code><a href="https://statisticsnz.github.io/simplevis/reference/gg_hbar.html" class="external-link">simplevis::gg_hbar()</a></code> call.</li></ul><hr></div>
<ul><li>Small change to <code><a href="../reference/hbar.html">hbar()</a></code>: removes error arg within <code><a href="https://statisticsnz.github.io/simplevis/reference/gg_hbar.html" class="external-link">simplevis::gg_hbar()</a></code> call.</li>
</ul><hr></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.2.9000" id="visualizer-0129000">visualizeR 0.1.2.9000<a class="anchor" aria-label="anchor" href="#visualizer-0129000"></a></h2>
<ul><li>There was a duplicate <code><a href="../reference/scale_color.html">scale_color()</a></code> function, which should have been and is now <code><a href="../reference/scale_fill.html">scale_fill()</a></code>
</li></ul><hr></div>
</li>
</ul><hr></div>
<div class="section level2">
<h2 class="pkg-version" data-toc-text="0.1.1.9000" id="visualizer-0119000">visualizeR 0.1.1.9000<a class="anchor" aria-label="anchor" href="#visualizer-0119000"></a></h2>
<ul><li>Added two horizontal bar functions: <code><a href="../reference/hbar.html">hbar()</a></code>, <code><a href="../reference/hbar_percent.html">hbar_percent()</a></code> (<a href="https://github.com/gnoblet/visualizeR/issues/3" class="external-link">#3</a>)</li>

View file

@ -1,8 +1,8 @@
pandoc: 2.14.0.3
pandoc: 2.17.1.1
pkgdown: 2.0.5
pkgdown_sha: ~
articles: {}
last_built: 2022-07-10T23:23Z
last_built: 2022-07-17T23:19Z
urls:
reference: https://gnoblet.github.io/visualizeR/reference
article: https://gnoblet.github.io/visualizeR/articles

View file

@ -57,7 +57,7 @@
<span> <span class="va">y</span>,</span>
<span> group <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> initiative <span class="op">=</span> <span class="st">"reach"</span>,</span>
<span> pal <span class="op">=</span> <span class="st">"primary"</span>,</span>
<span> palette <span class="op">=</span> <span class="st">"primary"</span>,</span>
<span> width <span class="op">=</span> <span class="fl">0.5</span>,</span>
<span> x_title <span class="op">=</span> <span class="st">""</span>,</span>
<span> y_title <span class="op">=</span> <span class="st">""</span>,</span>
@ -94,7 +94,7 @@
<dd><p>Either "reach" or "agora" or "impact" for the color palette</p></dd>
<dt>pal</dt>
<dt>palette</dt>
<dd><p>The color palette from the initiative</p></dd>

View file

@ -57,7 +57,7 @@
<span> <span class="va">y</span>,</span>
<span> group <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> initiative <span class="op">=</span> <span class="st">"reach"</span>,</span>
<span> pal <span class="op">=</span> <span class="st">"primary"</span>,</span>
<span> palette <span class="op">=</span> <span class="st">"primary"</span>,</span>
<span> width <span class="op">=</span> <span class="fl">0.5</span>,</span>
<span> x_title <span class="op">=</span> <span class="st">""</span>,</span>
<span> y_title <span class="op">=</span> <span class="st">""</span>,</span>
@ -94,7 +94,7 @@
<dd><p>Either "reach" or "agora" or "impact" for the color palette</p></dd>
<dt>pal</dt>
<dt>palette</dt>
<dd><p>The color palette from the initiative</p></dd>

File diff suppressed because one or more lines are too long

View file

@ -3,15 +3,15 @@
<url>
<loc>https://gnoblet.github.io/visualizeR/404.html</loc>
</url>
<url>
<loc>https://gnoblet.github.io/visualizeR/LICENSE.html</loc>
</url>
<url>
<loc>https://gnoblet.github.io/visualizeR/authors.html</loc>
</url>
<url>
<loc>https://gnoblet.github.io/visualizeR/index.html</loc>
</url>
<url>
<loc>https://gnoblet.github.io/visualizeR/LICENSE.html</loc>
</url>
<url>
<loc>https://gnoblet.github.io/visualizeR/news/index.html</loc>
</url>

View file

@ -10,7 +10,7 @@ hbar(
y,
group = NULL,
initiative = "reach",
pal = "primary",
palette = "primary",
width = 0.5,
x_title = "",
y_title = "",
@ -35,7 +35,7 @@ hbar(
\item{initiative}{Either "reach" or "agora" or "impact" for the color palette}
\item{pal}{The color palette from the initiative}
\item{palette}{The color palette from the initiative}
\item{width}{Width}

View file

@ -10,7 +10,7 @@ hbar_percent(
y,
group = NULL,
initiative = "reach",
pal = "primary",
palette = "primary",
width = 0.5,
x_title = "",
y_title = "",
@ -35,7 +35,7 @@ hbar_percent(
\item{initiative}{Either "reach" or "agora" or "impact" for the color palette}
\item{pal}{The color palette from the initiative}
\item{palette}{The color palette from the initiative}
\item{width}{Width}