class: inverse, left, bottom background-image: url(https://images.unsplash.com/photo-1542204165-65bf26472b9b?auto=format&fit=crop&q=80&w=1548&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D) background-size: cover # .Large[# My featurette] ## .small[featuring [{}]() ...] #### .tiny[Gina Reynolds | 2023-10-25 | Image credit: Denise Jans, Upsplash] ??? Title --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$is_free ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## is_free(...) ## ## <Inner function (f)> ## function () ## TRUE ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$range ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## range(...) ## ## <Inner function (f)> ## function (panel_params) ## { ## list(x = panel_params$x$dimension(), y = panel_params$y$dimension()) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$setup_panel_params ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_panel_params(..., self = self) ## ## <Inner function (f)> ## function (self, scale_x, scale_y, params = list()) ## { ## c(view_scales_from_scale(scale_x, self$limits$x, self$expand), ## view_scales_from_scale(scale_y, self$limits$y, self$expand)) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$render_axis_v ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_axis_v(...) ## ## <Inner function (f)> ## function (panel_params, theme) ## { ## list(left = panel_guides_grob(panel_params$guides, position = "left", ## theme = theme), right = panel_guides_grob(panel_params$guides, ## position = "right", theme = theme)) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$backtransform_backtransform_backtransform_range ``` ] .panel2-feature-replace[ ``` ## NULL ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$transform ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## transform(...) ## ## <Inner function (f)> ## function (data, panel_params) ## { ## data <- transform_position(data, panel_params$x$rescale, ## panel_params$y$rescale) ## transform_position(data, squish_infinite, squish_infinite) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$distance ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## distance(...) ## ## <Inner function (f)> ## function (x, y, panel_params) ## { ## max_dist <- dist_euclidean(panel_params$x$dimension(), panel_params$y$dimension()) ## dist_euclidean(x, y)/max_dist ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$render_bg ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_bg(...) ## ## <Inner function (f)> ## function (panel_params, theme) ## { ## guide_grid(theme, panel_params$x$break_positions_minor(), ## panel_params$x$break_positions(), panel_params$y$break_positions_minor(), ## panel_params$y$break_positions()) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$render_axis_h ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_axis_h(...) ## ## <Inner function (f)> ## function (panel_params, theme) ## { ## list(top = panel_guides_grob(panel_params$guides, position = "top", ## theme = theme), bottom = panel_guides_grob(panel_params$guides, ## position = "bottom", theme = theme)) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$super ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## super(...) ## ## <Inner function (f)> ## function () ## { ## eval(`_inherit`, env, NULL) ## } ``` ] --- count: false .panel1-feature-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordCartesian %>% * .$is_linear ``` ] .panel2-feature-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## is_linear(...) ## ## <Inner function (f)> ## function () ## TRUE ``` ] <style> .panel1-feature-replace { color: black; width: 32.6666666666667%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-feature-replace { color: black; width: 65.3333333333333%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-feature-replace { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$range ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## range(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params) ## { ## setNames(list(panel_params$theta.range, panel_params$r.range), ## c(self$theta, self$r)) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$setup_panel_params ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_panel_params(..., self = self) ## ## <Inner function (f)> ## function (self, scale_x, scale_y, params = list()) ## { ## c(view_scales_polar(scale_x, self$theta, expand = self$expand), ## view_scales_polar(scale_y, self$theta, expand = self$expand), ## list(bbox = polar_bbox(self$arc, donut = self$donut), ## arc = self$arc, donut = self$donut)) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$labels ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## labels(..., self = self) ## ## <Inner function (f)> ## function (self, labels, panel_params) ## { ## titles <- lapply(panel_params$guides$get_params(c("theta", ## "r", "r.sec")), function(x) x$title) ## if (self$theta == "y") { ## labels$y["primary"] <- list(titles[[1]] %|W|% labels$y$primary) ## labels$x["primary"] <- list(titles[[2]] %|W|% labels$x$primary) ## labels$x["secondary"] <- list(titles[[3]] %|W|% labels$x$secondary) ## if (any(in_arc(c(0, 1) * pi, panel_params$arc))) { ## labels <- list(x = labels$y, y = labels$x) ## } ## else { ## labels <- list(x = rev(labels$x), y = rev(labels$y)) ## } ## } ## else { ## labels$x["primary"] <- list(titles[[1]] %|W|% labels$x$primary) ## labels$y["primary"] <- list(titles[[2]] %|W|% labels$y$primary) ## labels$y["secondary"] <- list(titles[[3]] %|W|% labels$y$secondary) ## if (!any(in_arc(c(0, 1) * pi, panel_params$arc))) { ## labels <- list(x = rev(labels$y), y = rev(labels$x)) ## } ## } ## labels ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$render_axis_v ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_axis_v(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, theme) ## { ## if (self$r_axis_inside) { ## return(list(left = zeroGrob(), right = zeroGrob())) ## } ## list(left = panel_guides_grob(panel_params$guides, position = "left", ## theme = theme), right = panel_guides_grob(panel_params$guides, ## position = "right", theme = theme)) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$render_fg ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_fg(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, theme) ## { ## if (!self$r_axis_inside) { ## out <- grobTree(panel_guides_grob(panel_params$guides, ## "theta", theme), panel_guides_grob(panel_params$guides, ## "theta.sec", theme), element_render(theme, "panel.border")) ## return(out) ## } ## bbox <- panel_params$bbox ## dir <- self$direction ## arc <- if (dir == 1) ## self$arc ## else rev(self$arc) ## arc <- dir * rad2deg(-arc) ## left <- panel_guides_grob(panel_params$guides, position = "left", ## theme) ## left <- rotate_r_axis(left, arc[1], bbox, "left") ## right <- panel_guides_grob(panel_params$guides, position = "right", ## theme) ## right <- rotate_r_axis(right, arc[2], bbox, "right") ## grobTree(panel_guides_grob(panel_params$guides, "theta", ## theme), panel_guides_grob(panel_params$guides, "theta.sec", ## theme), left, right, element_render(theme, "panel.border")) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$backtransform_backtransform_backtransform_range ``` ] .panel2-feature2-replace[ ``` ## NULL ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$aspect ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## aspect(...) ## ## <Inner function (f)> ## function (details) ## { ## diff(details$bbox$y)/diff(details$bbox$x) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$transform ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## transform(..., self = self) ## ## <Inner function (f)> ## function (self, data, panel_params) ## { ## data <- rename_data(self, data) ## bbox <- panel_params$bbox %||% list(x = c(0, 1), y = c(0, ## 1)) ## arc <- panel_params$arc %||% c(0, 2 * pi) ## data$r <- r_rescale(data$r, panel_params$r.range, panel_params$donut) ## data$theta <- theta_rescale(data$theta, panel_params$theta.range, ## arc, self$direction) ## data$x <- rescale(data$r * sin(data$theta) + 0.5, from = bbox$x) ## data$y <- rescale(data$r * cos(data$theta) + 0.5, from = bbox$y) ## if (self$rotate_angle && "angle" %in% names(data)) { ## data$angle <- flip_text_angle(data$angle - rad2deg(data$theta)) ## } ## data ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$distance ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## distance(..., self = self) ## ## <Inner function (f)> ## function (self, x, y, details) ## { ## arc <- details$arc %||% c(0, 2 * pi) ## if (self$theta == "x") { ## r <- rescale(y, from = details$r.range, to = self$donut/0.4) ## theta <- theta_rescale_no_clip(x, details$theta.range, ## arc, self$direction) ## } ## else { ## r <- rescale(x, from = details$r.range, to = self$donut/0.4) ## theta <- theta_rescale_no_clip(y, details$theta.range, ## arc, self$direction) ## } ## dist_polar(r, theta) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$render_bg ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_bg(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, theme) ## { ## bbox <- panel_params$bbox %||% list(x = c(0, 1), y = c(0, ## 1)) ## arc <- panel_params$arc %||% c(0, 2 * pi) ## dir <- self$direction ## donut <- panel_params$donut ## theta_lim <- panel_params$theta.range ## theta_maj <- panel_params$theta.major ## theta_min <- setdiff(panel_params$theta.minor, theta_maj) ## if (length(theta_maj) > 0) { ## theta_maj <- theta_rescale(theta_maj, theta_lim, arc, ## dir) ## } ## if (length(theta_min) > 0) { ## theta_min <- theta_rescale(theta_min, theta_lim, arc, ## dir) ## } ## theta_fine <- seq(self$arc[1], self$arc[2], length.out = 100) ## r_fine <- r_rescale(panel_params$r.major, panel_params$r.range, ## panel_params$donut) ## grid_elems <- paste(c("panel.grid.major.", "panel.grid.minor.", ## "panel.grid.major."), c(self$theta, self$theta, self$r), ## sep = "") ## grid_elems <- lapply(grid_elems, calc_element, theme = theme) ## majortheta <- paste("panel.grid.major.", self$theta, sep = "") ## minortheta <- paste("panel.grid.minor.", self$theta, sep = "") ## majorr <- paste("panel.grid.major.", self$r, sep = "") ## bg_element <- calc_element("panel.background", theme) ## if (!inherits(bg_element, "element_blank")) { ## background <- data_frame0(x = c(Inf, Inf, -Inf, -Inf), ## y = c(Inf, -Inf, -Inf, Inf)) ## background <- coord_munch(self, background, panel_params, ## is_closed = TRUE) ## bg_gp <- gpar(lwd = len0_null(bg_element$linewidth * ## .pt), col = bg_element$colour, fill = bg_element$fill, ## lty = bg_element$linetype) ## background <- polygonGrob(x = background$x, y = background$y, ## gp = bg_gp) ## } ## else { ## background <- zeroGrob() ## } ## ggname("grill", grobTree(background, theta_grid(theta_maj, ## grid_elems[[1]], donut, bbox), theta_grid(theta_min, ## grid_elems[[2]], donut, bbox), element_render(theme, ## majorr, name = "radius", x = rescale(rep(r_fine, each = length(theta_fine)) * ## rep(sin(theta_fine), length(r_fine)) + 0.5, from = bbox$x), ## y = rescale(rep(r_fine, each = length(theta_fine)) * ## rep(cos(theta_fine), length(r_fine)) + 0.5, from = bbox$y), ## id.lengths = rep(length(theta_fine), length(r_fine)), ## default.units = "native"))) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$modify_scales ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## modify_scales(..., self = self) ## ## <Inner function (f)> ## function (self, scales_x, scales_y) ## { ## if (self$theta != "y") ## return() ## lapply(scales_x, scale_flip_position) ## lapply(scales_y, scale_flip_position) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$train_panel_guides ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## train_panel_guides(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, layers, params = list()) ## { ## aesthetics <- c("r", "theta", "r.sec", "theta.sec") ## aesthetics <- intersect(aesthetics, names(panel_params$guides$aesthetics)) ## names(aesthetics) <- aesthetics ## guides <- panel_params$guides$get_guide(aesthetics) ## names(guides) <- aesthetics ## empty <- vapply(guides, inherits, logical(1), "GuideNone") ## gdefs <- panel_params$guides$get_params(aesthetics) ## names(gdefs) <- aesthetics ## for (t in intersect(c("theta", "theta.sec"), aesthetics[!empty])) { ## gdefs[[t]] <- guides[[t]]$train(gdefs[[t]], panel_params[[t]]) ## gdefs[[t]] <- guides[[t]]$transform(gdefs[[t]], self, ## panel_params) ## gdefs[[t]] <- guides[[t]]$get_layer_key(gdefs[[t]], layers) ## } ## if (self$r_axis_inside) { ## mod <- list(bbox = list(x = c(0, 1), y = c(0, 1)), arc = c(0, ## 2 * pi)) ## } ## else { ## mod <- list(arc = params$fake_arc) ## } ## temp <- modify_list(panel_params, mod) ## for (r in intersect(c("r", "r.sec"), aesthetics[!empty])) { ## gdefs[[r]] <- guides[[r]]$train(gdefs[[r]], panel_params[[r]]) ## gdefs[[r]] <- guides[[r]]$transform(gdefs[[r]], self, ## temp) ## gdefs[[r]] <- guides[[r]]$get_layer_key(gdefs[[r]], layers) ## } ## panel_params$guides$update_params(gdefs) ## panel_params ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$setup_panel_guides ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_panel_guides(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, guides, params = list()) ## { ## aesthetics <- c("r", "theta", "r.sec", "theta.sec") ## names(aesthetics) <- aesthetics ## is_sec <- grepl("sec$", aesthetics) ## scales <- panel_params[aesthetics] ## panel_params$theta$guide <- panel_params$theta$guide %|W|% ## guide_axis_theta() ## guides <- guides$setup(scales, aesthetics, default = params$guide_default %||% ## guide_axis(), missing = params$guide_missing %||% guide_none()) ## drop_guides <- character(0) ## for (type in aesthetics) { ## drop_guides <- check_polar_guide(drop_guides, guides, ## type) ## } ## guide_params <- guides$get_params(aesthetics) ## names(guide_params) <- aesthetics ## guide_params[["theta"]]$position <- "theta" ## guide_params[["theta.sec"]]$position <- "theta.sec" ## if (self$r_axis_inside) { ## arc <- rad2deg(self$arc) ## r_position <- c("left", "right") ## if (self$direction == -1) { ## arc <- rev(arc) ## r_position <- rev(r_position) ## } ## guide_params[["r"]]$position <- r_position[1] ## guide_params[["r.sec"]]$position <- r_position[2] ## guide_params[["r"]]$angle <- guide_params[["r"]]$angle %|W|% ## arc[1] ## guide_params[["r.sec"]]$angle <- guide_params[["r.sec"]]$angle %|W|% ## arc[2] ## } ## else { ## guide_params[["r"]]$position <- params$r_axis ## guide_params[["r.sec"]]$position <- opposite_position(params$r_axis) ## } ## guide_params[drop_guides] <- list(NULL) ## guides$update_params(guide_params) ## panel_params$guides <- guides ## panel_params ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$render_axis_h ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## render_axis_h(..., self = self) ## ## <Inner function (f)> ## function (self, panel_params, theme) ## { ## if (self$r_axis_inside) { ## return(list(top = zeroGrob(), bottom = zeroGrob())) ## } ## list(top = panel_guides_grob(panel_params$guides, position = "top", ## theme = theme), bottom = panel_guides_grob(panel_params$guides, ## position = "bottom", theme = theme)) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$super ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## super(...) ## ## <Inner function (f)> ## function () ## { ## eval(`_inherit`, env, NULL) ## } ``` ] --- count: false .panel1-feature2-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::CoordRadial %>% * .$setup_params ``` ] .panel2-feature2-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_params(..., self = self) ## ## <Inner function (f)> ## function (self, data) ## { ## if (!self$r_axis_inside) { ## place <- in_arc(c(0, 0.5, 1, 1.5) * pi, self$arc) ## if (place[1]) { ## return(list(r_axis = "left", fake_arc = c(0, 2) * ## pi)) ## } ## if (place[3]) { ## return(list(r_axis = "left", fake_arc = c(1, 3) * ## pi)) ## } ## if (place[2]) { ## return(list(r_axis = "bottom", fake_arc = c(0.5, ## 2.5) * pi)) ## } ## if (place[4]) { ## return(list(r_axis = "bottom", fake_arc = c(1.5, ## 3.5) * pi)) ## } ## cli::cli_warn(c("No appropriate placement found for {.arg r_axis_inside}.", ## i = "Axis will be placed at panel edge.")) ## self$r_axis_inside <- TRUE ## } ## return(NULL) ## } ``` ] <style> .panel1-feature2-replace { color: black; width: 32.6666666666667%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-feature2-replace { color: black; width: 65.3333333333333%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-feature2-replace { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$default_aes ``` ] .panel2-feature3-replace[ ``` ## Aesthetic mapping: ## * `x` -> `after_stat(count)` ## * `y` -> `after_stat(count)` ## * `weight` -> 1 ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$extra_params ``` ] .panel2-feature3-replace[ ``` ## [1] "na.rm" "orientation" ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$super ``` ] .panel2-feature3-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## super(...) ## ## <Inner function (f)> ## function () ## { ## eval(`_inherit`, env, NULL) ## } ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$compute_group ``` ] .panel2-feature3-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## compute_group(..., self = self) ## ## <Inner function (f)> ## function (self, data, scales, width = NULL, flipped_aes = FALSE) ## { ## data <- flip_data(data, flipped_aes) ## x <- data$x ## weight <- data$weight %||% rep(1, length(x)) ## count <- as.numeric(tapply(weight, x, sum, na.rm = TRUE)) ## count[is.na(count)] <- 0 ## bars <- data_frame0(count = count, prop = count/sum(abs(count)), ## x = sort(unique0(x)), width = width, flipped_aes = flipped_aes, ## .size = length(count)) ## flip_data(bars, flipped_aes) ## } ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$required_aes ``` ] .panel2-feature3-replace[ ``` ## [1] "x|y" ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$setup_params ``` ] .panel2-feature3-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_params(..., self = self) ## ## <Inner function (f)> ## function (self, data, params) ## { ## params$flipped_aes <- has_flipped_aes(data, params, main_is_orthogonal = FALSE) ## has_x <- !(is.null(data$x) && is.null(params$x)) ## has_y <- !(is.null(data$y) && is.null(params$y)) ## if (!has_x && !has_y) { ## cli::cli_abort("{.fn {snake_class(self)}} requires an {.field x} or {.field y} aesthetic.") ## } ## if (has_x && has_y) { ## cli::cli_abort("{.fn {snake_class(self)}} must only have an {.field x} {.emph or} {.field y} aesthetic.") ## } ## if (is.null(params$width)) { ## x <- if (params$flipped_aes) ## "y" ## else "x" ## params$width <- resolution(data[[x]]) * 0.9 ## } ## params ## } ``` ] --- count: false .panel1-feature3-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::StatCount %>% * .$dropped_aes ``` ] .panel2-feature3-replace[ ``` ## [1] "weight" ``` ] <style> .panel1-feature3-replace { color: black; width: 32.6666666666667%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-feature3-replace { color: black; width: 65.3333333333333%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-feature3-replace { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$setup_data ``` ] .panel2-feature4-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_data(...) ## ## <Inner function (f)> ## function (data, params) ## { ## data$flipped_aes <- params$flipped_aes ## data <- flip_data(data, params$flipped_aes) ## data$width <- data$width %||% params$width %||% (min(vapply(split(data$x, ## data$PANEL), resolution, numeric(1), zero = FALSE)) * ## 0.9) ## data$just <- params$just %||% 0.5 ## data <- transform(data, ymin = pmin(y, 0), ymax = pmax(y, ## 0), xmin = x - width * just, xmax = x + width * (1 - ## just), width = NULL, just = NULL) ## flip_data(data, params$flipped_aes) ## } ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$rename_size ``` ] .panel2-feature4-replace[ ``` ## [1] TRUE ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$non_missing_aes ``` ] .panel2-feature4-replace[ ``` ## [1] "xmin" "xmax" "ymin" "ymax" ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$extra_params ``` ] .panel2-feature4-replace[ ``` ## [1] "just" "na.rm" "orientation" ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$super ``` ] .panel2-feature4-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## super(...) ## ## <Inner function (f)> ## function () ## { ## eval(`_inherit`, env, NULL) ## } ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$required_aes ``` ] .panel2-feature4-replace[ ``` ## [1] "x" "y" ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$draw_panel ``` ] .panel2-feature4-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## draw_panel(..., self = self) ## ## <Inner function (f)> ## function (self, data, panel_params, coord, lineend = "butt", ## linejoin = "mitre", width = NULL, flipped_aes = FALSE) ## { ## ggproto_parent(GeomRect, self)$draw_panel(data, panel_params, ## coord, lineend = lineend, linejoin = linejoin) ## } ``` ] --- count: false .panel1-feature4-replace[ ```r # tidytuesday data library(tidyverse) ggplot2::GeomBar %>% * .$setup_params ``` ] .panel2-feature4-replace[ ``` ## <ggproto method> ## <Wrapper function> ## function (...) ## setup_params(...) ## ## <Inner function (f)> ## function (data, params) ## { ## params$flipped_aes <- has_flipped_aes(data, params) ## params ## } ``` ] <style> .panel1-feature4-replace { color: black; width: 32.6666666666667%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-feature4-replace { color: black; width: 65.3333333333333%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-feature4-replace { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- --- ### Contribute - https://github.com/EvaMaeRey/ggcirclepack --- ### Check out {packcircles} which does the computation in ggcirclepack - https://github.com/mbedward/packcircles --- ### Check out flipbookr, used to build this featurette - https://github.com/EvaMaeRey/flipbookr - discussion: https://github.com/EvaMaeRey/flipbookr/blob/master/docs/draft_jasa_submission.pdf --- ### Check out more featurettes - https://EvaMaeRey.github.io/featurette <style type="text/css"> .remark-code{line-height: 1.5; font-size: 100%} @media print { .has-continuation { display: block; } } </style>