Wrap text arg
This commit is contained in:
parent
5e6ceefe22
commit
4861a4c59d
1 changed files with 4 additions and 4 deletions
8
R/bar.R
8
R/bar.R
|
|
@ -21,7 +21,7 @@
|
||||||
#' @return A bar chart
|
#' @return A bar chart
|
||||||
#'
|
#'
|
||||||
#' @export
|
#' @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 :
|
# To do :
|
||||||
# - automate bar width and text size, or at least give the flexibility and still center text
|
# - 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
|
# Add title, subtitle, caption, x_title, y_title
|
||||||
g <- g + ggplot2::labs(
|
g <- g + ggplot2::labs(
|
||||||
title = title,
|
title = stringr::str_wrap(title, title_wrap),
|
||||||
subtitle = subtitle,
|
subtitle = stringr::str_wrap(subtitle, subtitle_wrap),
|
||||||
caption = caption,
|
caption = stringr::str_wrap(caption, caption_wrap),
|
||||||
x = x_title,
|
x = x_title,
|
||||||
y = y_title,
|
y = y_title,
|
||||||
color = group_title,
|
color = group_title,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue