Skip to content

Commit

Permalink
Fix #121
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed May 27, 2022
1 parent d41f99f commit 891a632
Show file tree
Hide file tree
Showing 63 changed files with 131 additions and 520 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggblanket
Title: Wrappers to Simplify Beautiful 'ggplot2' Visualisation
Version: 1.0.9000
Version: 1.1.0
Authors@R:
person("David", "Hodge", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3868-7501"))
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ggblanket 1.1.0

* Remove default sentence case transformation of categorical variable labels.
* Make scales work for position = "fill" in the same way as everything else.
* Other minor changes.

# ggblanket 1.0.0

* Initial release.
18 changes: 2 additions & 16 deletions R/gg_area.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @param x_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param x_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param x_labels A function to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param x_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param x_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param x_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand All @@ -33,7 +33,7 @@
#' @param y_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param y_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param y_labels A functiyon to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param y_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param y_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param y_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand Down Expand Up @@ -680,13 +680,6 @@ gg_area <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") x_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
x_limits <- c(NA, NA)
}

if (rlang::is_null(x_limits)) x_limits <- c(min(x_breaks), max(x_breaks))
if (rlang::is_null(x_expand)) x_expand <- c(0, 0)
}
Expand Down Expand Up @@ -764,13 +757,6 @@ gg_area <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") y_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
y_limits <- c(NA, NA)
}

if (rlang::is_null(y_limits)) y_limits <- c(min(y_breaks), max(y_breaks))
if (rlang::is_null(y_expand)) y_expand <- c(0, 0)
}
Expand Down
18 changes: 2 additions & 16 deletions R/gg_bar.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @param x_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param x_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param x_labels A function to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param x_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param x_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param x_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand All @@ -34,7 +34,7 @@
#' @param y_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param y_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param y_labels A functiyon to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param y_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param y_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param y_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand Down Expand Up @@ -696,13 +696,6 @@ gg_bar <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") x_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
x_limits <- c(NA, NA)
}

if (rlang::is_null(x_limits)) x_limits <- c(min(x_breaks), max(x_breaks))
if (rlang::is_null(x_expand)) x_expand <- c(0, 0)
}
Expand Down Expand Up @@ -780,13 +773,6 @@ gg_bar <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") y_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
y_limits <- c(NA, NA)
}

if (rlang::is_null(y_limits)) y_limits <- c(min(y_breaks), max(y_breaks))
if (rlang::is_null(y_expand)) y_expand <- c(0, 0)
}
Expand Down
18 changes: 2 additions & 16 deletions R/gg_blank.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' @param x_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param x_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param x_labels A function to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param x_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param x_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param x_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand All @@ -35,7 +35,7 @@
#' @param y_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param y_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param y_labels A functiyon to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param y_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param y_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param y_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand Down Expand Up @@ -727,13 +727,6 @@ gg_blank <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") x_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
x_limits <- c(NA, NA)
}

if (rlang::is_null(x_limits)) x_limits <- c(min(x_breaks), max(x_breaks))
if (rlang::is_null(x_expand)) x_expand <- c(0, 0)
}
Expand Down Expand Up @@ -811,13 +804,6 @@ gg_blank <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") y_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
y_limits <- c(NA, NA)
}

if (rlang::is_null(y_limits)) y_limits <- c(min(y_breaks), max(y_breaks))
if (rlang::is_null(y_expand)) y_expand <- c(0, 0)
}
Expand Down
18 changes: 2 additions & 16 deletions R/gg_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @param x_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param x_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param x_labels A function to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param x_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param x_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param x_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand All @@ -34,7 +34,7 @@
#' @param y_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param y_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param y_labels A functiyon to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param y_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param y_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param y_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand Down Expand Up @@ -699,13 +699,6 @@ gg_boxplot <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") x_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
x_limits <- c(NA, NA)
}

if (rlang::is_null(x_limits)) x_limits <- c(min(x_breaks), max(x_breaks))
if (rlang::is_null(x_expand)) x_expand <- c(0, 0)
}
Expand Down Expand Up @@ -783,13 +776,6 @@ gg_boxplot <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") y_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
y_limits <- c(NA, NA)
}

if (rlang::is_null(y_limits)) y_limits <- c(min(y_breaks), max(y_breaks))
if (rlang::is_null(y_expand)) y_expand <- c(0, 0)
}
Expand Down
18 changes: 2 additions & 16 deletions R/gg_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @param x_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param x_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param x_labels A function to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param x_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param x_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param x_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param x_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand All @@ -34,7 +34,7 @@
#' @param y_expand Add padding to the limits with the ggplot2::expansion function, or a vector of length 2.
#' @param y_oob A scales::oob_* function for how to deal with out-of-bounds values.
#' @param y_labels A functiyon to format the scale labels, including in rlang lambda format. Use ~.x to remove default transformation. If numeric, accepts a vector. If categorical, accepts a named vector (e.g. c(value = "label", ...)).
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. Use c(NA, NA) for the min and max.
#' @param y_limits For a numeric or date variable, a vector of length 2 to determine the limits of the axis. For a numeric variable, use c(NA, NA) to use the min and max as limits. For a date variable, load lubridate package and use c(NA_Date_, NA_Date_) to use the min and max as limits.
#' @param y_title Axis title string. Defaults to converting to sentence case with spaces. Use "" for no title.
#' @param y_zero For a numeric variable, TRUE or FALSE of whether the axis should include zero. Defaults to FALSE.
#' @param y_zero_mid For a numeric variable, TRUE or FALSE of whether to put zero in the middle of the axis. Defaults to FALSE.
Expand Down Expand Up @@ -683,13 +683,6 @@ gg_col <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") x_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
x_limits <- c(NA, NA)
}

if (rlang::is_null(x_limits)) x_limits <- c(min(x_breaks), max(x_breaks))
if (rlang::is_null(x_expand)) x_expand <- c(0, 0)
}
Expand Down Expand Up @@ -767,13 +760,6 @@ gg_col <- function(data = NULL,
}
}

if (length(class(position)) == 1) {
if (position == "fill") y_limits <- c(NA, NA)
}
else if (class(position)[1] == "PositionFill"){
y_limits <- c(NA, NA)
}

if (rlang::is_null(y_limits)) y_limits <- c(min(y_breaks), max(y_breaks))
if (rlang::is_null(y_expand)) y_expand <- c(0, 0)
}
Expand Down
Loading

0 comments on commit 891a632

Please sign in to comment.