Intro Thoughts

Status Quo

library(tidyverse)

Experiment

library(ggwedge)
diamonds %>% 
  ggplot() +
  ggwedge:::geom_pie() + 
  coord_polar() + 
  aes(fill = cut)

layer_all_stages <- function(){

a <- ggtrace::layer_before_stat() %>% head(3)
b <- ggtrace::layer_after_stat() %>% head(3)
c <- ggtrace::layer_before_geom() %>% head(3)
d <- ggtrace::layer_after_scale() %>% head(3)

list(before_stat = a, after_stat = b, 
     before_geom = c, after_scale = d)

}

layer_all_stages()
## $before_stat
## # A tibble: 3 × 3
##   fill    PANEL group
##   <ord>   <fct> <int>
## 1 Ideal   1         5
## 2 Premium 1         4
## 3 Good    1         2
## 
## $after_stat
## # A tibble: 3 × 18
##   PANEL fill      group count cum_n   xmax   xmin     r    r0  ymin  ymax     y
##   <fct> <ord>     <int> <dbl> <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1     Fair          1  1610  1610 0.0298 0       131.     0     0  131.     0
## 2 1     Good          2  4906  6516 0.121  0.0298  131.     0     0  131.     0
## 3 1     Very Good     3 12082 18598 0.345  0.121   131.     0     0  131.     0
## # ℹ 6 more variables: prop <dbl>, percent <chr>, r_prop <dbl>, r_nudge <dbl>,
## #   x <dbl>, y_text <dbl>
## 
## $before_geom
## # A tibble: 3 × 18
##   group PANEL fill      count cum_n   xmax   xmin     r    r0  ymin  ymax     y
##   <int> <fct> <ord>     <dbl> <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1     1 1     Fair       1610  1610 0.0298 0       131.     0     0  131.     0
## 2     2 1     Good       4906  6516 0.121  0.0298  131.     0     0  131.     0
## 3     3 1     Very Good 12082 18598 0.345  0.121   131.     0     0  131.     0
## # ℹ 6 more variables: prop <dbl>, percent <chr>, r_prop <dbl>, r_nudge <dbl>,
## #   x <dbl>, y_text <dbl>
## 
## $after_scale
## # A tibble: 3 × 22
##   fill      group PANEL count cum_n   xmax   xmin     r    r0  ymin  ymax     y
##   <chr>     <int> <fct> <dbl> <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 #440154FF     1 1      1610  1610 0.0298 0       131.     0     0  131.     0
## 2 #3B528BFF     2 1      4906  6516 0.121  0.0298  131.     0     0  131.     0
## 3 #21908CFF     3 1     12082 18598 0.345  0.121   131.     0     0  131.     0
## # ℹ 10 more variables: prop <dbl>, percent <chr>, r_prop <dbl>, r_nudge <dbl>,
## #   x <dbl>, y_text <dbl>, colour <lgl>, linewidth <dbl>, linetype <dbl>,
## #   alpha <lgl>
summary_layer_preview_all <- function(df = F){
  
for (i in 1:length(layer_all_stages())){
  
  print(names(layer_all_stages()[i]))
  print(names(layer_all_stages()[[i]]))
  print(nrow(layer_all_stages()[[i]]))
  
  if(df){print(layer_all_stages()[[i]])}

  
}
}

summary_layer_preview_all()
## [1] "before_stat"
## [1] "fill"  "PANEL" "group"
## [1] 3
## [1] "after_stat"
##  [1] "PANEL"   "fill"    "group"   "count"   "cum_n"   "xmax"    "xmin"   
##  [8] "r"       "r0"      "ymin"    "ymax"    "y"       "prop"    "percent"
## [15] "r_prop"  "r_nudge" "x"       "y_text" 
## [1] 3
## [1] "before_geom"
##  [1] "group"   "PANEL"   "fill"    "count"   "cum_n"   "xmax"    "xmin"   
##  [8] "r"       "r0"      "ymin"    "ymax"    "y"       "prop"    "percent"
## [15] "r_prop"  "r_nudge" "x"       "y_text" 
## [1] 3
## [1] "after_scale"
##  [1] "fill"      "group"     "PANEL"     "count"     "cum_n"     "xmax"     
##  [7] "xmin"      "r"         "r0"        "ymin"      "ymax"      "y"        
## [13] "prop"      "percent"   "r_prop"    "r_nudge"   "x"         "y_text"   
## [19] "colour"    "linewidth" "linetype"  "alpha"    
## [1] 3

Closing remarks, Other Relevant Work, Caveats