From 2c6be8e146c4acc046d8276d8e9957b77b0e8b9d Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:32:11 -0500 Subject: [PATCH 01/11] Add stringr --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 20aabba..3ba3de9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,6 +23,7 @@ Imports: rlang, grDevices, glue, - scales + scales, + stringr Suggests: knitr, sf, tmap VignetteBuilder: knitr From 5e6ceefe2239c1b8b2ef5bf70467395cdd94d4f7 Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:32:30 -0500 Subject: [PATCH 02/11] Align title and caption to plot --- R/theme_reach.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/theme_reach.R b/R/theme_reach.R index 254f5e9..4dea754 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -87,7 +87,9 @@ theme_reach <- function( panel.grid.minor.x = ggplot2::element_blank(), panel.grid.minor.y = ggplot2::element_blank(), # Remove background for legend key - legend.key = ggplot2::element_blank() + legend.key = ggplot2::element_blank(), + plot.title.position = "plot", + plot.caption.position = "plot" ) # Axis lines ? From 4861a4c59db6f710590ded2002167a8d0eb78f1f Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:32:37 -0500 Subject: [PATCH 03/11] Wrap text arg --- R/bar.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/bar.R b/R/bar.R index 24ddae8..db4bfd3 100644 --- a/R/bar.R +++ b/R/bar.R @@ -21,7 +21,7 @@ #' @return A bar chart #' #' @export -bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, 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()){ +bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, 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 = "", title_wrap = 60, subtitle_wrap = 60, caption_wrap = 120, theme = theme_reach()){ # To do : # - automate bar width and text size, or at least give the flexibility and still center text @@ -41,9 +41,9 @@ bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, position = # Add title, subtitle, caption, x_title, y_title g <- g + ggplot2::labs( - title = title, - subtitle = subtitle, - caption = caption, + title = stringr::str_wrap(title, title_wrap), + subtitle = stringr::str_wrap(subtitle, subtitle_wrap), + caption = stringr::str_wrap(caption, caption_wrap), x = x_title, y = y_title, color = group_title, From 291e46ef73a56b75c64221b4acb00a65b7887d9f Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:35:28 -0500 Subject: [PATCH 04/11] Add axis text and title size --- R/theme_reach.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/theme_reach.R b/R/theme_reach.R index 4dea754..25d8825 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -46,6 +46,8 @@ theme_reach <- function( legend_reverse = TRUE, axis_x = TRUE, axis_y = TRUE, + axis_text_size = 10, + axis_title_size = 11, grid_x = FALSE, grid_y = FALSE, grid_color = cols_reach("main_lt_grey"), @@ -89,7 +91,10 @@ theme_reach <- function( # Remove background for legend key legend.key = ggplot2::element_blank(), plot.title.position = "plot", - plot.caption.position = "plot" + plot.caption.position = "plot", + # Text sizes + axis.text = ggplot2::element_text(size = axis_text_size), + axis.title = ggplot2::element_text(size = axis_title_size) ) # Axis lines ? From bdb44ed82fd2f7cb12aaa19b35708eef67656eae Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:40:48 -0500 Subject: [PATCH 05/11] Add missing documentation --- R/bar.R | 3 +++ R/theme_reach.R | 2 ++ 2 files changed, 5 insertions(+) diff --git a/R/bar.R b/R/bar.R index db4bfd3..8a9216e 100644 --- a/R/bar.R +++ b/R/bar.R @@ -16,6 +16,9 @@ #' @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 title_wrap Wrap title, number of characters. +#' @param subtitle_wrap Wrap subtitle, number of characters. +#' @param caption_wrap Wrap caption, number of characters. #' @param theme Whatever theme. Default to theme_reach(). #' #' @return A bar chart diff --git a/R/theme_reach.R b/R/theme_reach.R index 25d8825..30784a6 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -16,6 +16,8 @@ #' @param legend_reverse Reverse the color in the guide? Default to TRUE. #' @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_title_size Axis title size. #' @param grid_x Boolean. Do you need major grid lines for x-axis? #' @param grid_y Boolean. Do you need major grid lines for y-axis? #' @param grid_x_size X line size. From e8a6734d0f331cdb845a01284521ff34045adac2 Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 11:41:58 -0500 Subject: [PATCH 06/11] Add wraps for title, subtitle, and caption --- R/point.R | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/R/point.R b/R/point.R index 3ef72c1..16e296f 100644 --- a/R/point.R +++ b/R/point.R @@ -1,4 +1,4 @@ -#' @title Simple bar chart +#' @title Simple point chart #' #' @param df A data frame. #' @param x A numeric column. @@ -13,12 +13,15 @@ #' @param title Plot title. Default to NULL. #' @param subtitle Plot subtitle. Default to NULL. #' @param caption Plot caption. Default to NULL. +#' @param title_wrap Wrap title, number of characters. +#' @param subtitle_wrap Wrap subtitle, number of characters. +#' @param caption_wrap Wrap caption, number of characters. #' @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()){ +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, title_wrap = 60, subtitle_wrap = 60, caption_wrap = 120, theme = theme_reach()){ # To do : # - automate bar width and text size, or at least give the flexibility and still center text @@ -38,9 +41,9 @@ point <- function(df, x, y, group = NULL, flip = TRUE, alpha = 1, size = 1, x_ti # Add title, subtitle, caption, x_title, y_title g <- g + ggplot2::labs( - title = title, - subtitle = subtitle, - caption = caption, + title = stringr::str_wrap(title, title_wrap), + subtitle = stringr::str_wrap(subtitle, subtitle_wrap), + caption = stringr::str_wrap(caption, caption_wrap), x = x_title, y = y_title, color = group_title, From 6ff42bac73f8fd7b1c754c7cff14c42ce580314d Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 12:19:47 -0500 Subject: [PATCH 07/11] Wraping of title, caption and subtitle pass to theming --- DESCRIPTION | 3 ++- R/bar.R | 11 ++++------- R/point.R | 11 ++++------- R/theme_reach.R | 6 +++++- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3ba3de9..a72e1ef 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,6 +24,7 @@ Imports: grDevices, glue, scales, - stringr + stringr, + ggtext Suggests: knitr, sf, tmap VignetteBuilder: knitr diff --git a/R/bar.R b/R/bar.R index 8a9216e..24ddae8 100644 --- a/R/bar.R +++ b/R/bar.R @@ -16,15 +16,12 @@ #' @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 title_wrap Wrap title, number of characters. -#' @param subtitle_wrap Wrap subtitle, number of characters. -#' @param caption_wrap Wrap caption, number of characters. #' @param theme Whatever theme. Default to theme_reach(). #' #' @return A bar chart #' #' @export -bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, 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 = "", title_wrap = 60, subtitle_wrap = 60, caption_wrap = 120, theme = theme_reach()){ +bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, 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 @@ -44,9 +41,9 @@ bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, position = # Add title, subtitle, caption, x_title, y_title g <- g + ggplot2::labs( - title = stringr::str_wrap(title, title_wrap), - subtitle = stringr::str_wrap(subtitle, subtitle_wrap), - caption = stringr::str_wrap(caption, caption_wrap), + title = title, + subtitle = subtitle, + caption = caption, x = x_title, y = y_title, color = group_title, diff --git a/R/point.R b/R/point.R index 16e296f..9dae4bf 100644 --- a/R/point.R +++ b/R/point.R @@ -13,15 +13,12 @@ #' @param title Plot title. Default to NULL. #' @param subtitle Plot subtitle. Default to NULL. #' @param caption Plot caption. Default to NULL. -#' @param title_wrap Wrap title, number of characters. -#' @param subtitle_wrap Wrap subtitle, number of characters. -#' @param caption_wrap Wrap caption, number of characters. #' @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, title_wrap = 60, subtitle_wrap = 60, caption_wrap = 120, theme = theme_reach()){ +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 @@ -41,9 +38,9 @@ point <- function(df, x, y, group = NULL, flip = TRUE, alpha = 1, size = 1, x_ti # Add title, subtitle, caption, x_title, y_title g <- g + ggplot2::labs( - title = stringr::str_wrap(title, title_wrap), - subtitle = stringr::str_wrap(subtitle, subtitle_wrap), - caption = stringr::str_wrap(caption, caption_wrap), + title = title, + subtitle = subtitle, + caption = caption, x = x_title, y = y_title, color = group_title, diff --git a/R/theme_reach.R b/R/theme_reach.R index 30784a6..99036e9 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -96,7 +96,11 @@ theme_reach <- function( plot.caption.position = "plot", # Text sizes axis.text = ggplot2::element_text(size = axis_text_size), - axis.title = ggplot2::element_text(size = axis_title_size) + axis.title = ggplot2::element_text(size = axis_title_size), + # Wrap title + plot.title = ggtext::element_textbox_simple(), + plot.subtitle = ggtext::element_textbox_simple(), + plot.caption = ggtext::element_textbox_simple() ) # Axis lines ? From 519c9c62a378d2896f68c1b2ad87da8ef63bd3bc Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 12:43:32 -0500 Subject: [PATCH 08/11] Add wrapping to x discrete labels --- R/bar.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/bar.R b/R/bar.R index 24ddae8..895eb92 100644 --- a/R/bar.R +++ b/R/bar.R @@ -6,6 +6,7 @@ #' @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. @@ -21,7 +22,7 @@ #' @return A bar chart #' #' @export -bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, 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()){ +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 @@ -88,6 +89,10 @@ bar <- function(df, x, y, group = NULL, flip = TRUE, percent = TRUE, position = 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() From 652976724ba2b77485047d0454d9b7e79f59d126 Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 13:12:19 -0500 Subject: [PATCH 09/11] Add further parameters for theming Title position Legend title and text size, color and font face Axis title and text color and font face Caption position --- R/theme_reach.R | 54 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/R/theme_reach.R b/R/theme_reach.R index 99036e9..a54eb8e 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -14,15 +14,24 @@ #' @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 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_title_size Axis title size. +#' @param axis_text_color Axis title color. +#' @param axis_text_font_face Axis title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). #' @param grid_x Boolean. Do you need major grid lines for x-axis? #' @param grid_y Boolean. Do you need major grid lines for y-axis? #' @param grid_x_size X line size. #' @param grid_y_size Y line size. #' @param grid_color 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()`. #' #' @@ -39,22 +48,31 @@ theme_reach <- function( 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 = "bold", + 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", 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", grid_x = FALSE, grid_y = FALSE, grid_color = cols_reach("main_lt_grey"), grid_x_size = 0.1, grid_y_size = 0.1, + caption_position_to_plot = TRUE, ... ) { @@ -92,17 +110,41 @@ theme_reach <- function( panel.grid.minor.y = ggplot2::element_blank(), # Remove background for legend key legend.key = ggplot2::element_blank(), - plot.title.position = "plot", - plot.caption.position = "plot", # Text sizes - axis.text = ggplot2::element_text(size = axis_text_size), - axis.title = ggplot2::element_text(size = axis_title_size), + 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_simple(), plot.subtitle = ggtext::element_textbox_simple(), - plot.caption = ggtext::element_textbox_simple() + plot.caption = ggtext::element_textbox_simple(), + legend.title = ggplot2::element_text( + size = legend_title_size, + face = legend_title_font_face, + family = font_family, + color = legend_title_color) ) + # 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 + From 9d924696739c413a6b491528fa54ea78b2c84789 Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 13:17:25 -0500 Subject: [PATCH 10/11] Missing arg doc --- R/theme_reach.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/theme_reach.R b/R/theme_reach.R index a54eb8e..15f95cf 100644 --- a/R/theme_reach.R +++ b/R/theme_reach.R @@ -13,6 +13,9 @@ #' @param panel_background_color 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_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_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. @@ -24,8 +27,8 @@ #' @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_title_size Axis title size. -#' @param axis_text_color Axis title color. -#' @param axis_text_font_face Axis title font face. Default to "plain". Font face ("plain", "italic", "bold", "bold.italic"). +#' @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_x Boolean. Do you need major grid lines for x-axis? #' @param grid_y Boolean. Do you need major grid lines for y-axis? #' @param grid_x_size X line size. From 560d5288dba78f881f6f5b2b715719f10f22a55f Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 21 Dec 2022 13:21:01 -0500 Subject: [PATCH 11/11] Update to v0.5.9000 --- DESCRIPTION | 3 +- NEWS.md | 8 +++ README.Rmd | 2 +- README.md | 2 +- docs/404.html | 2 +- docs/LICENSE.html | 2 +- docs/authors.html | 2 +- docs/index.html | 4 +- docs/news/index.html | 10 ++- docs/pkgdown.yml | 2 +- docs/reference/abort_bad_argument.html | 2 +- docs/reference/add_admin_boundaries.html | 2 +- docs/reference/add_admin_labels.html | 2 +- docs/reference/add_compass.html | 2 +- docs/reference/add_credits.html | 2 +- docs/reference/add_indicator_layer.html | 2 +- docs/reference/add_layout.html | 2 +- docs/reference/add_scale_bar.html | 2 +- docs/reference/bar.html | 7 +- docs/reference/border_admin0.html | 2 +- docs/reference/buffer_bbox.html | 2 +- docs/reference/centroid_admin1.html | 2 +- docs/reference/cols_agora.html | 2 +- docs/reference/cols_impact.html | 2 +- docs/reference/cols_reach.html | 2 +- .../figures/README-example-bar-chart-1.png | Bin 31732 -> 20658 bytes .../figures/README-example-bar-chart-2.png | Bin 26252 -> 16692 bytes .../figures/README-example-bar-chart-3.png | Bin 26983 -> 27085 bytes .../figures/README-example-point-chart-1.png | Bin 118291 -> 120261 bytes .../figures/README-example-point-chart-2.png | Bin 309857 -> 310727 bytes .../figures/README-example-point-chart-3.png | Bin 148569 -> 148785 bytes docs/reference/frontier_admin0.html | 2 +- docs/reference/if_not_in_stop.html | 2 +- docs/reference/if_vec_not_in_stop.html | 2 +- docs/reference/index.html | 4 +- docs/reference/indicator_admin1.html | 2 +- docs/reference/line_admin1.html | 2 +- docs/reference/pal_agora.html | 2 +- docs/reference/pal_impact.html | 2 +- docs/reference/pal_reach.html | 2 +- docs/reference/point.html | 8 +-- docs/reference/scale_color.html | 2 +- docs/reference/scale_fill.html | 2 +- docs/reference/subvec_not_in.html | 2 +- docs/reference/theme_reach.html | 65 ++++++++++++++++-- docs/search.json | 2 +- man/bar.Rd | 3 + man/figures/README-example-bar-chart-1.png | Bin 31732 -> 20658 bytes man/figures/README-example-bar-chart-2.png | Bin 26252 -> 16692 bytes man/figures/README-example-bar-chart-3.png | Bin 26983 -> 27085 bytes man/figures/README-example-point-chart-1.png | Bin 118291 -> 120261 bytes man/figures/README-example-point-chart-2.png | Bin 309857 -> 310727 bytes man/figures/README-example-point-chart-3.png | Bin 148569 -> 148785 bytes man/point.Rd | 4 +- man/theme_reach.Rd | 41 +++++++++-- 55 files changed, 166 insertions(+), 55 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a72e1ef..80c3d5d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: visualizeR Type: Package Title: What a color! What a viz! -Version: 0.4.9000 +Version: 0.5.9000 Authors@R: c( person( 'Noblet', 'Guillaume', @@ -24,7 +24,6 @@ Imports: grDevices, glue, scales, - stringr, ggtext Suggests: knitr, sf, tmap VignetteBuilder: knitr diff --git a/NEWS.md b/NEWS.md index eb52999..1c505d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# 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`. diff --git a/README.Rmd b/README.Rmd index 16cdf8e..72ea8c9 100644 --- a/README.Rmd +++ b/README.Rmd @@ -109,7 +109,7 @@ point(penguins, bill_length_mm, flipper_length_mm) 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_x = T)) +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_x = T, title_position_to_plot = FALSE)) ``` ## Maps diff --git a/README.md b/README.md index 79104a1..01231ad 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ point(penguins, bill_length_mm, flipper_length_mm, island, alpha = 0.6, size = 3 ``` 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_x = T)) +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_x = T, title_position_to_plot = FALSE)) ``` diff --git a/docs/404.html b/docs/404.html index b309118..5eb2dff 100644 --- a/docs/404.html +++ b/docs/404.html @@ -31,7 +31,7 @@ visualizeR - 0.4.9000 + 0.5.9000