-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f365cd
commit 7c75df3
Showing
20 changed files
with
445 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
#' #' Lineribbon ggplot | ||
#' #' | ||
#' #' @description Create a lineribbon ggplot with a wrapper around [ggplot2::ggplot()] + [geom_ribbon()][ggplot2::geom_ribbon()] + [geom_line()][ggplot2::geom_line()] | ||
#' #' | ||
#' #' @inheritParams gg_blanket | ||
#' #' | ||
#' #' @return A ggplot object. | ||
#' #' @export | ||
#' #' | ||
#' #' @examples | ||
#' #' library(ggplot2) | ||
#' #' library(dplyr) | ||
#' #' | ||
#' #' set_blanket() | ||
#' #' | ||
#' #' data.frame(year = 1875:1972, level = as.vector(LakeHuron)) |> | ||
#' #' mutate(level_min = level - 1, level_max = level + 1) |> | ||
#' #' gg_ribbon_line( | ||
#' #' x = year, | ||
#' #' y = level, | ||
#' #' ymin = level_min, | ||
#' #' ymax = level_max, | ||
#' #' x_labels = \(x) x, | ||
#' #' blend = "multiply", | ||
#' #' ) | ||
#' #' | ||
#' gg_col_errorbar <- function(data = NULL, | ||
#' ..., | ||
#' stat = "identity", | ||
#' position = "identity", | ||
#' coord = ggplot2::coord_cartesian(clip = "off"), | ||
#' mode = NULL, mode_orientation = NULL, blend = NULL, | ||
#' x = NULL, | ||
#' xmin = NULL, | ||
#' xmax = NULL, | ||
#' xend = NULL, | ||
#' y = NULL, | ||
#' ymin = NULL, | ||
#' ymax = NULL, | ||
#' yend = NULL, | ||
#' z = NULL, | ||
#' col = NULL, | ||
#' facet = NULL, | ||
#' facet2 = NULL, | ||
#' group = NULL, | ||
#' subgroup = NULL, | ||
#' label = NULL, | ||
#' text = NULL, | ||
#' sample = NULL, | ||
#' mapping = NULL, | ||
#' x_breaks = NULL, x_breaks_n = NULL, | ||
#' x_expand = NULL, | ||
#' x_expand_limits = NULL, | ||
#' x_label = NULL, x_labels = NULL, | ||
#' | ||
#' | ||
#' x_position = "bottom", | ||
#' | ||
#' x_sec_axis = ggplot2::waiver(), x_symmetric = NULL, x_transform = NULL, | ||
#' y_breaks = NULL, y_breaks_n = NULL, | ||
#' y_expand = NULL, | ||
#' y_expand_limits = NULL, | ||
#' y_label = NULL, y_labels = NULL, | ||
#' y_position = "left", | ||
#' y_sec_axis = ggplot2::waiver(), | ||
#' y_symmetric = NULL, | ||
#' | ||
#' y_transform = NULL, | ||
#' col_breaks = NULL, col_breaks_n = 5, | ||
#' col_drop = FALSE, | ||
#' col_expand_limits = NULL, | ||
#' col_label = NULL, col_labels = NULL, | ||
#' col_legend_ncol = NULL, | ||
#' col_legend_nrow = NULL, | ||
#' col_legend_rev = FALSE, | ||
#' | ||
#' | ||
#' col_palette = NULL, | ||
#' col_palette_na = NULL, | ||
#' col_rescale = scales::rescale(), | ||
#' col_steps = FALSE, | ||
#' | ||
#' col_transform = NULL, | ||
#' facet_axes = NULL, | ||
#' facet_axis_labels = "margins", | ||
#' facet_drop = FALSE, | ||
#' facet_labels = NULL, | ||
#' facet_layout = NULL, | ||
#' facet_ncol = NULL, | ||
#' facet_nrow = NULL, | ||
#' facet_scales = "fixed", | ||
#' facet_space = "fixed", | ||
#' title = NULL, | ||
#' subtitle = NULL, | ||
#' caption = NULL, | ||
#' label_to_case = snakecase::to_sentence_case) { | ||
#' plot <- gg_blanket( | ||
#' data = data, | ||
#' geom = "blank", | ||
#' stat = stat, | ||
#' position = position, | ||
#' coord = coord, | ||
#' mode = mode, mode_orientation = mode_orientation, blend = blend, | ||
#' x = {{ x }}, | ||
#' y = {{ y }}, | ||
#' xmin = {{ xmin }}, | ||
#' xmax = {{ xmax }}, | ||
#' xend = {{ xend }}, | ||
#' ymin = {{ ymin }}, | ||
#' ymax = {{ ymax }}, | ||
#' yend = {{ yend }}, | ||
#' z = {{ z }}, | ||
#' col = {{ col }}, | ||
#' facet = {{ facet }}, | ||
#' facet2 = {{ facet2 }}, | ||
#' group = {{ group }}, | ||
#' subgroup = {{ subgroup }}, | ||
#' label = {{ label }}, | ||
#' text = {{ text }}, | ||
#' sample = {{ sample }}, | ||
#' mapping = mapping, | ||
#' x_breaks = x_breaks, | ||
#' x_expand = x_expand, | ||
#' x_expand_limits = x_expand_limits, | ||
#' x_labels = x_labels, | ||
#' x_breaks_n = x_breaks_n, | ||
#' x_sec_axis = x_sec_axis, | ||
#' x_symmetric = x_symmetric, x_position = x_position, | ||
#' x_label = x_label, | ||
#' x_transform = x_transform, | ||
#' y_breaks = y_breaks, | ||
#' y_expand = y_expand, | ||
#' y_expand_limits = y_expand_limits, | ||
#' y_labels = y_labels, | ||
#' y_breaks_n = y_breaks_n, | ||
#' y_sec_axis = y_sec_axis, | ||
#' y_symmetric = y_symmetric, y_position = y_position, | ||
#' y_label = y_label, | ||
#' y_transform = y_transform, | ||
#' col_breaks = col_breaks, | ||
#' col_drop = col_drop, | ||
#' col_expand_limits = col_expand_limits, | ||
#' col_labels = col_labels, | ||
#' 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_palette = col_palette, | ||
#' col_palette_na = col_palette_na, | ||
#' col_rescale = col_rescale, | ||
#' col_steps = col_steps, | ||
#' col_label = col_label, | ||
#' col_transform = col_transform, | ||
#' facet_axes = facet_axes, | ||
#' facet_axis_labels = facet_axis_labels, | ||
#' facet_drop = facet_drop, | ||
#' facet_labels = facet_labels, | ||
#' facet_layout = facet_layout, | ||
#' facet_ncol = facet_ncol, | ||
#' facet_nrow = facet_nrow, | ||
#' facet_scales = facet_scales, | ||
#' facet_space = facet_space, | ||
#' title = title, | ||
#' subtitle = subtitle, | ||
#' caption = caption, | ||
#' label_to_case = label_to_case, | ||
#' ... | ||
#' ) | ||
#' | ||
#' if (rlang::is_null(blend)) { | ||
#' plot + | ||
#' list( | ||
#' ggplot2::layer( | ||
#' geom = "bar", | ||
#' stat = stat, | ||
#' position = position, | ||
#' mapping = ggplot2::aes(!!!mapping), | ||
#' params = rlang::list2(...), | ||
#' # show.legend = show_legend, | ||
#' ), | ||
#' ggplot2::layer( | ||
#' geom = "errorbar", | ||
#' stat = stat, | ||
#' position = position, | ||
#' mapping = ggplot2::aes(!!!mapping), | ||
#' params = rlang::list2(...), | ||
#' # show.legend = show_legend, | ||
#' ) | ||
#' ) | ||
#' } | ||
#' else { | ||
#' plot + | ||
#' ggblend::blend( | ||
#' list( | ||
#' ggplot2::layer( | ||
#' geom = "bar", | ||
#' stat = stat, | ||
#' position = position, | ||
#' mapping = ggplot2::aes(!!!mapping), | ||
#' params = rlang::list2(...), | ||
#' # show.legend = show_legend, | ||
#' ) |> ggblend::blend(blend = blend), | ||
#' ggplot2::layer( | ||
#' geom = "errorbar", | ||
#' stat = stat, | ||
#' position = position, | ||
#' mapping = ggplot2::aes(!!!mapping), | ||
#' params = rlang::list2(...), | ||
#' # show.legend = show_legend, | ||
#' ) |> ggblend::blend(blend = blend) | ||
#' ), blend = blend | ||
#' ) | ||
#' | ||
#' } | ||
#' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.