Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed Jul 2, 2024
1 parent 9f55f3f commit e20c61b
Show file tree
Hide file tree
Showing 96 changed files with 1,569 additions and 1,413 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export(light_mode_r)
export(light_mode_t)
export(lightness)
export(linewidthness)
export(mode_orientation_x)
export(mode_orientation_y)
export(navy)
export(orange)
export(pink)
Expand Down
1 change: 0 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

* Breaking: removed `*_limits` and `*_oob` arguments.
* Breaking: removed `*_mode_n` and `grey_mode_*` functions.
* Breaking: removed `*_orientation` arguments.
* Breaking: removed `greyness` helper.
* Added `*_breaks_n` and `*_sec_axis` arguments.
* Added `*_symmetric` arguments.
Expand Down
38 changes: 18 additions & 20 deletions R/dark_mode.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#' @param legend_ticks_colour The colour of the legend.ticks theme element.
#' @param legend_ticks_linewidth The linewidth of the legend.ticks theme element.
#' @param legend_ticks_length The legend.ticks.length theme element.
#' @param x_orientation TRUE or FALSE for whether it should be orientated to the x axis. Use outside of gg_* functions only.
#' @param y_orientation TRUE or FALSE for whether it should be orientated to the y axis. Use outside of gg_* functions only.
#'
#' @return A ggplot theme.
#' @export
Expand Down Expand Up @@ -84,9 +82,9 @@ dark_mode_r <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_r(
base_size = base_size,
Expand Down Expand Up @@ -123,9 +121,9 @@ dark_mode_r <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


)
}

Expand All @@ -152,9 +150,9 @@ dark_mode_t <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_t(
base_size = base_size,
Expand Down Expand Up @@ -191,9 +189,9 @@ dark_mode_t <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


)
}

Expand All @@ -220,9 +218,9 @@ dark_mode_b <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_b(
base_size = base_size,
Expand Down Expand Up @@ -259,8 +257,8 @@ dark_mode_b <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


)
}
81 changes: 21 additions & 60 deletions R/flex_mode.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#' @param legend_ticks_colour The colour of the legend.ticks theme element.
#' @param legend_ticks_linewidth The linewidth of the legend.ticks theme element.
#' @param legend_ticks_length The legend.ticks.length theme element.
#' @param orientation The orientation of the plot. Either "x" or "y". Defaults to NULL. Not intended for use with the mode argument of gg_* functions.
#'
#' @return A ggplot theme.
#' @keywords internal
Expand Down Expand Up @@ -75,9 +74,9 @@ flex_mode_base <- function(
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL
legend_ticks_length = ggplot2::rel(c(0.175, 0))


) {

theme <- ggplot2::theme(
Expand Down Expand Up @@ -184,44 +183,6 @@ flex_mode_base <- function(
complete = FALSE
)

# if (rlang::is_null(x_orientation)) x_orientation <- FALSE
# if (rlang::is_null(y_orientation)) y_orientation <- FALSE

if (!rlang::is_null(x_orientation) | !rlang::is_null(y_orientation)) {
if (rlang::is_null(x_orientation) & !rlang::is_null(y_orientation)) {
x_orientation <- !y_orientation
}
else if (rlang::is_null(y_orientation) & !rlang::is_null(x_orientation)) {
y_orientation <- !x_orientation
}
if (x_orientation | !y_orientation) {
theme <- theme +
ggplot2::theme(
panel.grid.major.x = ggplot2::element_blank(),
panel.grid.minor.x = ggplot2::element_blank(),
axis.line.y.left = ggplot2::element_blank(),
axis.line.y.right = ggplot2::element_blank(),
axis.ticks.y.left = ggplot2::element_blank(),
axis.ticks.y.right = ggplot2::element_blank(),
axis.minor.ticks.y.left = ggplot2::element_blank(),
axis.minor.ticks.y.right = ggplot2::element_blank()
)
}
else if (!x_orientation | y_orientation) {
theme <- theme +
ggplot2::theme(
panel.grid.major.y = ggplot2::element_blank(),
panel.grid.minor.y = ggplot2::element_blank(),
axis.line.x.top = ggplot2::element_blank(),
axis.line.x.bottom = ggplot2::element_blank(),
axis.ticks.x.top = ggplot2::element_blank(),
axis.ticks.x.bottom = ggplot2::element_blank(),
axis.minor.ticks.x.top = ggplot2::element_blank(),
axis.minor.ticks.x.bottom = ggplot2::element_blank()
)
}
}

return(theme)
}

Expand Down Expand Up @@ -270,9 +231,9 @@ flex_mode_r <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_base(
base_size = base_size,
Expand Down Expand Up @@ -308,9 +269,9 @@ flex_mode_r <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


)
}

Expand Down Expand Up @@ -358,9 +319,9 @@ flex_mode_t <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_base(
base_size = base_size,
Expand Down Expand Up @@ -396,9 +357,9 @@ flex_mode_t <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


) +
ggplot2::theme(
legend.position = "top",
Expand Down Expand Up @@ -461,9 +422,9 @@ flex_mode_b <- function (
legend_key_fill = plot_background_fill,
legend_ticks_colour = legend_axis_line_colour,
legend_ticks_linewidth = legend_axis_line_linewidth,
legend_ticks_length = ggplot2::rel(c(0.175, 0)),
x_orientation = NULL,
y_orientation = NULL) {
legend_ticks_length = ggplot2::rel(c(0.175, 0))

) {

flex_mode_base(
base_size = base_size,
Expand Down Expand Up @@ -499,9 +460,9 @@ flex_mode_b <- function (
legend_key_fill = legend_key_fill,
legend_ticks_colour = legend_ticks_colour,
legend_ticks_linewidth = legend_ticks_linewidth,
legend_ticks_length = legend_ticks_length,
x_orientation = x_orientation,
y_orientation = y_orientation
legend_ticks_length = legend_ticks_length


) +
ggplot2::theme(
legend.position = "bottom",
Expand Down
40 changes: 20 additions & 20 deletions R/gg_area.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gg_area <- function(data = NULL,
stat = "align",
position = "stack",
coord = ggplot2::coord_cartesian(clip = "off"),
mode = NULL,
mode = NULL, mode_orientation = NULL,
x = NULL,
xmin = NULL,
xmax = NULL,
Expand All @@ -47,35 +47,35 @@ gg_area <- function(data = NULL,
x_breaks = NULL,
x_expand = NULL,
x_expand_limits = NULL,
x_labels = NULL,
x_breaks_n = NULL,
x_sec_axis = ggplot2::waiver(),
x_symmetric = NULL, x_position = "bottom",
x_label = NULL,
x_transform = NULL,
x_label = NULL, x_labels = NULL, x_n_breaks = NULL,


x_position = "bottom",

x_sec_axis = ggplot2::waiver(), x_symmetric = NULL, x_transform = NULL,
y_breaks = NULL,
y_expand = NULL,
y_expand_limits = NULL,
y_labels = NULL,
y_breaks_n = NULL,
y_label = NULL, y_labels = NULL,
y_n_breaks = NULL, y_position = "left",
y_sec_axis = ggplot2::waiver(),
y_symmetric = NULL, y_position = "left",
y_label = NULL,
y_symmetric = NULL,

y_transform = NULL,
col_breaks = NULL,
col_drop = FALSE,
col_expand_limits = NULL,
col_labels = NULL,
col_label = NULL, col_labels = NULL,
col_legend_ncol = NULL,
col_legend_nrow = NULL,
col_legend_rev = FALSE,
col_breaks_n = 5,
col_n_breaks = 5,

col_palette = NULL,
col_palette_na = NULL,
col_rescale = scales::rescale(),
col_steps = FALSE,
col_label = NULL,

col_transform = NULL,
facet_axes = NULL,
facet_axis_labels = "margins",
Expand All @@ -96,7 +96,7 @@ gg_area <- function(data = NULL,
stat = stat,
position = position,
coord = coord,
mode = mode,
mode = mode, mode_orientation = mode_orientation,
x = {{ x }},
y = {{ y }},
xmin = {{ xmin }},
Expand All @@ -119,7 +119,7 @@ gg_area <- function(data = NULL,
x_expand = x_expand,
x_expand_limits = x_expand_limits,
x_labels = x_labels,
x_breaks_n = x_breaks_n,
x_n_breaks = x_n_breaks,
x_sec_axis = x_sec_axis,
x_symmetric = x_symmetric, x_position = x_position,
x_label = x_label,
Expand All @@ -128,7 +128,7 @@ gg_area <- function(data = NULL,
y_expand = y_expand,
y_expand_limits = y_expand_limits,
y_labels = y_labels,
y_breaks_n = y_breaks_n,
y_n_breaks = y_n_breaks,
y_sec_axis = y_sec_axis,
y_symmetric = y_symmetric, y_position = y_position,
y_label = y_label,
Expand All @@ -140,8 +140,8 @@ gg_area <- function(data = NULL,
col_legend_ncol = col_legend_ncol,
col_legend_nrow = col_legend_nrow,
col_legend_rev = col_legend_rev,
col_breaks_n = col_breaks_n,
col_n_breaks = col_n_breaks,

col_palette = col_palette,
col_palette_na = col_palette_na,
col_rescale = col_rescale,
Expand Down
Loading

0 comments on commit e20c61b

Please sign in to comment.