├── .Rbuildignore ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── CONDUCT.md ├── CRAN-SUBMISSION ├── DESCRIPTION ├── NAMESPACE ├── R ├── a-geom-rect.R ├── aaa.r ├── fontawesome.R ├── geom-pictogram.R ├── geom-rtile.R ├── geom-waffle.R ├── iron.R ├── saved-sw.R ├── stat-waffle.R ├── utils.r ├── waffle-enhance.R ├── waffle-package.R ├── waffle.R └── zzz.R ├── README.md ├── README.qmd ├── README_cache └── commonmark │ ├── __packages │ ├── f5_03d5bae8450bdaadd13ea6f1ab4a6065.RData │ ├── f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdb │ ├── f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdx │ ├── f8_cfd690625c28c35b29c8d938974bd88b.RData │ ├── f8_cfd690625c28c35b29c8d938974bd88b.rdb │ ├── f8_cfd690625c28c35b29c8d938974bd88b.rdx │ ├── fct_d5131e99fe673745f977578f10ca4f48.RData │ ├── fct_d5131e99fe673745f977578f10ca4f48.rdb │ ├── fct_d5131e99fe673745f977578f10ca4f48.rdx │ ├── fig0_b53874c78d0daf5e69442798ed0e9957.RData │ ├── fig0_b53874c78d0daf5e69442798ed0e9957.rdb │ ├── fig0_b53874c78d0daf5e69442798ed0e9957.rdx │ ├── fig1_fd8c7375634d9a3080bf76b1210ae135.RData │ ├── fig1_fd8c7375634d9a3080bf76b1210ae135.rdb │ ├── fig1_fd8c7375634d9a3080bf76b1210ae135.rdx │ ├── fig2_3e1d897a35fd64a9b04f809a167a7b22.RData │ ├── fig2_3e1d897a35fd64a9b04f809a167a7b22.rdb │ ├── fig2_3e1d897a35fd64a9b04f809a167a7b22.rdx │ ├── fig3_21436c60eef6e30e58acec0b7bc25f8b.RData │ ├── fig3_21436c60eef6e30e58acec0b7bc25f8b.rdb │ ├── fig3_21436c60eef6e30e58acec0b7bc25f8b.rdx │ ├── fig4_01ca1b499c0a5d6ca4c1a7a593a82338.RData │ ├── fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdb │ ├── fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdx │ ├── fig4a_cea4386fc158b50d4f068678a41ab9cd.RData │ ├── fig4a_cea4386fc158b50d4f068678a41ab9cd.rdb │ ├── fig4a_cea4386fc158b50d4f068678a41ab9cd.rdx │ ├── geoms_d324c5a7bdbfed2f829ee8446dfca165.RData │ ├── geoms_d324c5a7bdbfed2f829ee8446dfca165.rdb │ ├── geoms_d324c5a7bdbfed2f829ee8446dfca165.rdx │ ├── medkit0_b81d40f05aea16dff4fa3b419e1880cf.RData │ ├── medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdb │ ├── medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdx │ ├── medkit_e2b0af9f0792c7bc6e315f773241d501.RData │ ├── medkit_e2b0af9f0792c7bc6e315f773241d501.rdb │ ├── medkit_e2b0af9f0792c7bc6e315f773241d501.rdx │ ├── no_fct_42840b53bbaf9ee76ab713ef9ad6e208.RData │ ├── no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdb │ ├── no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdx │ ├── s2_f3fdec98ad58fa63b580d9d640ea59be.RData │ ├── s2_f3fdec98ad58fa63b580d9d640ea59be.rdb │ ├── s2_f3fdec98ad58fa63b580d9d640ea59be.rdx │ ├── s4_6cbe77ac6c30f0d75903003ad6256901.RData │ ├── s4_6cbe77ac6c30f0d75903003ad6256901.rdb │ ├── s4_6cbe77ac6c30f0d75903003ad6256901.rdx │ ├── s5_c4483722b97efa986ba51ccfd73914e8.RData │ ├── s5_c4483722b97efa986ba51ccfd73914e8.rdb │ ├── s5_c4483722b97efa986ba51ccfd73914e8.rdx │ ├── s6_1341d57d8f06bd280d326384360c3733.RData │ ├── s6_1341d57d8f06bd280d326384360c3733.rdb │ ├── s6_1341d57d8f06bd280d326384360c3733.rdx │ ├── t1_bb7c040bc8777672fefe54885238ee4d.RData │ ├── t1_bb7c040bc8777672fefe54885238ee4d.rdb │ ├── t1_bb7c040bc8777672fefe54885238ee4d.rdx │ ├── t2_f824a7f8d7299ec29da066a637c33377.RData │ ├── t2_f824a7f8d7299ec29da066a637c33377.rdb │ ├── t2_f824a7f8d7299ec29da066a637c33377.rdx │ ├── t5_b88afd9700b946468787378af40761ed.RData │ ├── t5_b88afd9700b946468787378af40761ed.rdb │ ├── t5_b88afd9700b946468787378af40761ed.rdx │ ├── unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.RData │ ├── unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdb │ ├── unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdx │ ├── unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.RData │ ├── unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdb │ ├── unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdx │ ├── unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.RData │ ├── unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdb │ ├── unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdx │ ├── waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.RData │ ├── waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdb │ └── waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdx ├── README_files └── figure-commonmark │ ├── f5-1.png │ ├── f8-1.png │ ├── fct-1.png │ ├── fig0-1.png │ ├── fig1-1.png │ ├── fig2-1.png │ ├── fig3-1.png │ ├── fig4a-1.png │ ├── geoms-1.png │ ├── medkit-1.png │ ├── new-bits-1.png │ ├── new-bits-2.png │ ├── new-bits-3.png │ ├── no_fct-1.png │ ├── unnamed-chunk-1-1.png │ ├── unnamed-chunk-1-2.png │ ├── unnamed-chunk-1-3.png │ ├── unnamed-chunk-2-1.png │ ├── unnamed-chunk-2-2.png │ ├── unnamed-chunk-2-3.png │ └── waffle-bars-1.png ├── inst ├── COPYRIGHTS ├── extdat │ └── fadf.rds ├── fonts │ ├── fa-brands-400.ttf │ └── fa-solid-900.ttf └── json │ └── icons.json.gz ├── man ├── draw_key_pictogram.Rd ├── fa5_brand.Rd ├── fa5_solid.Rd ├── fa_grep.Rd ├── fa_list.Rd ├── geom_pictogram.Rd ├── geom_waffle.Rd ├── install_fa_fonts.Rd ├── iron.Rd ├── scale_label_pictogram.Rd ├── theme_enhance_waffle.Rd ├── waffle-package.Rd └── waffle.Rd └── waffle.Rproj /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | ^README.*$ 5 | ^\.git$ 6 | ^\.vscode$ 7 | ^cran-comments\.md$ 8 | ^CONDUCT\.md$ 9 | ^\.github 10 | ^\.gitattributes 11 | ^CRAN-SUBMISSION$ 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | inst/css/fontawesome.css linguist-generated=true 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | patreon: hrbrmstr 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Rproj 5 | src/*.o 6 | src/*.so 7 | src/*.dll 8 | inst/doc 9 | -------------------------------------------------------------------------------- /CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who 4 | contribute through reporting issues, posting feature requests, updating documentation, 5 | submitting pull requests or patches, and other activities. 6 | 7 | We are committed to making participation in this project a harassment-free experience for 8 | everyone, regardless of level of experience, gender, gender identity and expression, 9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 10 | 11 | Examples of unacceptable behavior by participants include the use of sexual language or 12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment, 13 | insults, or other unprofessional conduct. 14 | 15 | Project maintainers have the right and responsibility to remove, edit, or reject comments, 16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this 17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed 18 | from the project team. 19 | 20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by 21 | opening an issue or contacting one or more of the project maintainers. 22 | 23 | This Code of Conduct is adapted from the Contributor Covenant 24 | (http:contributor-covenant.org), version 1.0.0, available at 25 | http://contributor-covenant.org/version/1/0/0/ 26 | -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 1.0.2 2 | Date: 2023-09-30 20:08:37 UTC 3 | SHA: 3f61463e6ab8d088ecff35db7cc1edfe633ee9f3 4 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: waffle 2 | Type: Package 3 | Title: Create Waffle Chart Visualizations 4 | Version: 1.0.2 5 | Date: 2023-09-30 6 | Authors@R: c( 7 | person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), 8 | comment = c(ORCID = "0000-0001-5670-2640")), 9 | person("Dave", "Gandy", role = "aut", comment = "Font Awesome"), 10 | person("Andrew", "Breza", email = "andrew.breza@gmail.com", role = "ctb"), 11 | person("Matthias", "Jütte", role = "ctb"), 12 | person("Paul", "Campbell", email = "pacampbell91@gmail.com", 13 | role = "ctb", comment = "geom_bar flip") 14 | ) 15 | Maintainer: Bob Rudis 16 | Description: Square pie charts (a.k.a. waffle charts) can be used 17 | to communicate parts of a whole for categorical quantities. To emulate the 18 | percentage view of a pie chart, a 10x10 grid should be used with each square 19 | representing 1% of the total. Modern uses of waffle charts do not 20 | necessarily adhere to this rule and can be created with a grid of any 21 | rectangular shape. Best practices suggest keeping the number of categories 22 | small, just as should be done when creating pie charts. Tools are provided 23 | to create waffle charts as well as stitch them together, and to use glyphs 24 | for making isotype pictograms. 25 | Encoding: UTF-8 26 | Copyright: file inst/COPYRIGHTS 27 | Suggests: 28 | knitr, 29 | rmarkdown, 30 | dplyr, 31 | ggthemes 32 | Depends: 33 | R (>= 3.5.0), 34 | ggplot2 (>= 3.1.0) 35 | License: GPL (>= 2) 36 | Imports: 37 | RColorBrewer, 38 | grid, 39 | gridExtra, 40 | gtable, 41 | extrafont, 42 | curl, 43 | stringr, 44 | stats, 45 | htmlwidgets, 46 | DT, 47 | plyr, 48 | rlang, 49 | utils 50 | RoxygenNote: 7.2.3 51 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(GeomPictogram) 4 | export(GeomWaffle) 5 | export(StatWaffle) 6 | export(draw_key_pictogram) 7 | export(fa5_brand) 8 | export(fa5_solid) 9 | export(fa_grep) 10 | export(fa_list) 11 | export(geom_pictogram) 12 | export(geom_waffle) 13 | export(install_fa_fonts) 14 | export(iron) 15 | export(scale_label_pictogram) 16 | export(stat_waffle) 17 | export(theme_enhance_waffle) 18 | export(waffle) 19 | import(DT) 20 | import(curl) 21 | import(gridExtra) 22 | import(htmlwidgets) 23 | import(stringr) 24 | importFrom(RColorBrewer,brewer.pal) 25 | importFrom(extrafont,choose_font) 26 | importFrom(extrafont,font_import) 27 | importFrom(extrafont,ttf_import) 28 | importFrom(ggplot2,aes) 29 | importFrom(ggplot2,alpha) 30 | importFrom(ggplot2,coord_equal) 31 | importFrom(ggplot2,discrete_scale) 32 | importFrom(ggplot2,element_blank) 33 | importFrom(ggplot2,element_rect) 34 | importFrom(ggplot2,element_text) 35 | importFrom(ggplot2,geom_point) 36 | importFrom(ggplot2,geom_text) 37 | importFrom(ggplot2,geom_tile) 38 | importFrom(ggplot2,ggplot) 39 | importFrom(ggplot2,ggplotGrob) 40 | importFrom(ggplot2,guide_legend) 41 | importFrom(ggplot2,guides) 42 | importFrom(ggplot2,labs) 43 | importFrom(ggplot2,layer) 44 | importFrom(ggplot2,scale_color_manual) 45 | importFrom(ggplot2,scale_fill_manual) 46 | importFrom(ggplot2,scale_x_continuous) 47 | importFrom(ggplot2,scale_y_continuous) 48 | importFrom(ggplot2,theme) 49 | importFrom(ggplot2,theme_bw) 50 | importFrom(grid,arrow) 51 | importFrom(grid,gpar) 52 | importFrom(grid,grid.draw) 53 | importFrom(grid,grid.newpage) 54 | importFrom(grid,grobTree) 55 | importFrom(grid,roundrectGrob) 56 | importFrom(grid,textGrob) 57 | importFrom(grid,unit) 58 | importFrom(grid,unit.c) 59 | importFrom(grid,unit.pmax) 60 | importFrom(grid,unit.pmin) 61 | importFrom(gtable,is.gtable) 62 | importFrom(plyr,a_ply) 63 | importFrom(rlang,is_missing) 64 | importFrom(stats,setNames) 65 | importFrom(utils,tail) 66 | -------------------------------------------------------------------------------- /R/a-geom-rect.R: -------------------------------------------------------------------------------- 1 | geom_rrect <- function(mapping = NULL, data = NULL, # nocov start 2 | stat = "identity", position = "identity", 3 | radius = grid::unit(6, "pt"), 4 | ..., 5 | na.rm = FALSE, 6 | show.legend = NA, 7 | inherit.aes = TRUE) { 8 | layer( 9 | data = data, 10 | mapping = mapping, 11 | stat = stat, 12 | geom = GeomRrect, 13 | position = position, 14 | show.legend = show.legend, 15 | inherit.aes = inherit.aes, 16 | params = list( 17 | radius = radius, 18 | na.rm = na.rm, 19 | ... 20 | ) 21 | ) 22 | } 23 | 24 | GeomRrect <- ggplot2::ggproto( 25 | "GeomRrect", ggplot2::Geom, 26 | 27 | default_aes = ggplot2::aes( 28 | fill = "grey35", size = 0.5, linetype = 1, alpha = NA#, colour = NA 29 | ), 30 | 31 | required_aes = c("xmin", "xmax", "ymin", "ymax"), 32 | 33 | draw_panel = function(self, data, panel_params, coord, 34 | radius = grid::unit(6, "pt")) { 35 | 36 | coords <- coord$transform(data, panel_params) 37 | 38 | lapply(1:length(coords$xmin), function(i) { 39 | 40 | grid::roundrectGrob( 41 | coords$xmin[i], coords$ymax[i], 42 | width = (coords$xmax[i] - coords$xmin[i]), 43 | height = (coords$ymax[i] - coords$ymin)[i], 44 | r = radius, 45 | default.units = "native", 46 | just = c("left", "top"), 47 | gp = grid::gpar( 48 | col = coords$colour[i], 49 | fill = alpha(coords$fill[i], coords$alpha[i]), 50 | lwd = coords$size[i] * .pt, 51 | lty = coords$linetype[i], 52 | lineend = "butt" 53 | ) 54 | ) 55 | 56 | }) -> gl 57 | 58 | grobs <- do.call(grid::gList, gl) 59 | 60 | ggname("geom_rrect", grid::grobTree(children = grobs)) 61 | 62 | }, 63 | 64 | draw_key = ggplot2::draw_key_polygon 65 | 66 | ) # nocov end -------------------------------------------------------------------------------- /R/aaa.r: -------------------------------------------------------------------------------- 1 | utils::globalVariables(c("x", "y", "value")) 2 | 3 | .dbg <- TRUE 4 | 5 | msg <- function(...) { 6 | 7 | if (.dbg) message(...) 8 | 9 | } -------------------------------------------------------------------------------- /R/fontawesome.R: -------------------------------------------------------------------------------- 1 | # Waffles mappings from css names to unicode chars was out of date 2 | # This variation updates it from the latests css from github 3 | .fa_unicode_init <- function() { 4 | 5 | xdf <- readRDS(system.file("extdat/fadf.rds", package = "waffle")) 6 | xdf[xdf[["type"]] != "regular", ] 7 | 8 | } 9 | 10 | .fa_unicode <- .fa_unicode_init() 11 | 12 | .display_fa <- function(fdf) { 13 | vb <- stringr::str_match(fdf[["glyph"]], '(viewBox="[^"]+")')[,2] 14 | stringr::str_replace( 15 | fdf[["glyph"]], 16 | vb, 17 | sprintf('%s width="24" height="24"', vb) 18 | ) -> fdf[["glyph"]] 19 | DT::datatable(fdf[,c("name", "type", "glyph")], escape = FALSE) 20 | } 21 | 22 | #' Search Font Awesome glyph names for a pattern 23 | #' 24 | #' @param pattern pattern to search for in the names of Font Awesome fonts 25 | #' @export 26 | fa_grep <- function(pattern) { 27 | res <- which(grepl(pattern, .fa_unicode[["name"]])) 28 | if (length(res)) { 29 | .display_fa(.fa_unicode[res, ]) 30 | } else { 31 | message("No Font Awesome font found with that name pattern.") 32 | } 33 | } 34 | 35 | #' List all Font Awesome glyphs 36 | #' 37 | #' @export 38 | fa_list <- function() { 39 | .display_fa(.fa_unicode) 40 | } 41 | 42 | #' Install Font Awesome 5 Fonts 43 | #' 44 | #' @export 45 | install_fa_fonts <- function() { 46 | message( 47 | "The TTF font files for Font Awesome 5 fonts are in:\n\n", 48 | system.file("fonts", package = "waffle"), 49 | "\n\nPlease navigate to that directory and install them on ", 50 | "your system." 51 | ) 52 | } 53 | 54 | #' Font Awesome 5 Solid 55 | #' 56 | #' @description `fa5_solid` is shorthand for "`FontAwesome5Free-Solid`" 57 | #' @docType data 58 | #' @export 59 | fa5_solid <- "FontAwesome5Free-Solid" 60 | 61 | #' Font Awesome 5 Brand 62 | #' 63 | #' @description `fa5_brand` is shorthand for "`FontAwesome5Brands-Regular`" 64 | #' @docType data 65 | #' @export 66 | fa5_brand <- "FontAwesome5Brands-Regular" 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /R/geom-pictogram.R: -------------------------------------------------------------------------------- 1 | picto_scale <- function(aesthetic, values = NULL, ...) { 2 | 3 | values <- if (is_missing(values)) "circle" else force(values) 4 | 5 | pal <- function(n) { 6 | vapply( 7 | if (n > length(values)) rep(values[[1]], n) else values, 8 | function(.x) .fa_unicode[.fa_unicode[["name"]] == .x, "unicode"], 9 | character(1), 10 | USE.NAMES = FALSE 11 | ) 12 | } 13 | 14 | discrete_scale(aesthetic, "manual", pal, ...) 15 | } 16 | 17 | #' Used with geom_pictogram() to map Font Awesome fonts to labels 18 | #' 19 | #' @param ... dots 20 | #' @param values values 21 | #' @param aesthetics aesthetics 22 | #' @export 23 | scale_label_pictogram <- function(..., values, aesthetics = "label") { 24 | picto_scale(aesthetics, values, ...) 25 | } 26 | 27 | #' Legend builder for pictograms 28 | #' 29 | #' @param data,params,size legend key things 30 | #' @keywords internal 31 | #' @export 32 | draw_key_pictogram <- function(data, params, size) { 33 | 34 | # msg("==> draw_key_pictogram()") 35 | # 36 | # print(str(data, 1)) 37 | # print(str(params, 1)) 38 | 39 | if (is.null(data$label)) data$label <- "a" 40 | 41 | textGrob( 42 | label = data$label, 43 | x = 0.5, y = 0.5, 44 | rot = data$angle %||% 0, 45 | hjust = data$hjust %||% 0, 46 | vjust = data$vjust %||% 0.5, 47 | gp = gpar( 48 | col = alpha(data$colour %||% data$fill %||% "black", data$alpha), 49 | fontfamily = data$family %||% "", 50 | fontface = data$fontface %||% 1, 51 | fontsize = (data$size %||% 3.88) * .pt, 52 | lineheight = 1.5 53 | ) 54 | ) 55 | } 56 | 57 | #' Pictogram Geom 58 | #' 59 | #' There are two special/critical `aes()` mappings: 60 | #' - `label` (so the geom knows which column to map the glyphs to) 61 | #' - `values` (which column you're mapping the filling for the squares with) 62 | #' 63 | #' @md 64 | #' @param mapping Set of aesthetic mappings created by `aes()` or 65 | #' `aes_()`. If specified and `inherit.aes = TRUE` (the 66 | #' default), it is combined with the default mapping at the top level of the 67 | #' plot. You must supply `mapping` if there is no plot mapping. 68 | #' @param n_rows how many rows should there be in the waffle chart? default is 10 69 | #' @param flip If `TRUE`, flip x and y coords. n_rows then becomes n_cols. 70 | #' Useful to achieve waffle column chart effect. Defaults is `FALSE`. 71 | #' @param make_proportional compute proportions from the raw values? (i.e. each 72 | #' value `n` will be replaced with `n`/`sum(n)`); default is `FALSE`. 73 | #' @param data The data to be displayed in this layer. There are three 74 | #' options: 75 | #' 76 | #' If `NULL`, the default, the data is inherited from the plot 77 | #' data as specified in the call to `ggplot()`. 78 | #' 79 | #' A `data.frame`, or other object, will override the plot 80 | #' data. All objects will be fortified to produce a data frame. See 81 | #' `fortify()` for which variables will be created. 82 | #' 83 | #' A `function` will be called with a single argument, 84 | #' the plot data. The return value must be a `data.frame.`, and 85 | #' will be used as the layer data. 86 | #' @param na.rm If `FALSE`, the default, missing values are removed with 87 | #' a warning. If `TRUE`, missing values are silently removed. 88 | #' @param show.legend logical. Should this layer be included in the legends? 89 | #' `NA`, the default, includes if any aesthetics are mapped. 90 | #' `FALSE` never includes, and `TRUE` always includes. 91 | #' It can also be a named logical vector to finely select the aesthetics to 92 | #' display. 93 | #' @param inherit.aes If `FALSE`, overrides the default aesthetics, 94 | #' rather than combining with them. This is most useful for helper functions 95 | #' that define both data and aesthetics and shouldn't inherit behaviour from 96 | #' the default plot specification, e.g. `borders()`. 97 | #' @param ... other arguments passed on to `layer()`. These are 98 | #' often aesthetics, used to set an aesthetic to a fixed value, like 99 | #' `color = "red"` or `size = 3`. They may also be parameters 100 | #' to the paired geom/stat. 101 | #' @export 102 | geom_pictogram <- function(mapping = NULL, data = NULL, 103 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 104 | ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) { 105 | 106 | layer( 107 | data = data, 108 | mapping = mapping, 109 | stat = "waffle", 110 | geom = "pictogram", 111 | position = "identity", 112 | show.legend = show.legend, 113 | inherit.aes = inherit.aes, 114 | params = list( 115 | na.rm = na.rm, 116 | n_rows = n_rows, 117 | make_proportional = make_proportional, 118 | flip = flip, 119 | ... 120 | ) 121 | ) 122 | } 123 | 124 | #' @rdname geom_pictogram 125 | #' @export 126 | GeomPictogram <- ggplot2::ggproto( 127 | `_class` = "GeomPictogram", 128 | `_inherit` = GeomText, 129 | 130 | # required_aes = c("x", "y", "label", "colour"), 131 | 132 | default_aes = aes( 133 | fill = NA, alpha = NA, colour = "black", 134 | size = 9, angle = 0, hjust = 0.5, vjust = 0.5, 135 | family = "FontAwesome5Free-Solid", fontface = 1, lineheight = 1 136 | ), 137 | 138 | 139 | draw_group = function(self, data, panel_params, coord, 140 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 141 | radius = grid::unit(0, "npc")) { 142 | 143 | # msg("Called => GeomPictogram::draw_group()") 144 | 145 | coord <- ggplot2::coord_equal() 146 | grobs <- GeomText$draw_panel(data, panel_params, coord, parse = FALSE, check_overlap = FALSE) 147 | 148 | # msg("Done With => GeomPictogram::draw_group()") 149 | 150 | ggname("geom_pictogram", grid::grobTree(children = grobs)) 151 | 152 | }, 153 | 154 | 155 | draw_panel = function(self, data, panel_params, coord, 156 | n_rows = 10, make_proportional = FALSE, flip = FALSE, ...) { 157 | 158 | # msg("Called => GeomPictogram::draw_panel()") 159 | # print(str(data, 1)) 160 | 161 | coord <- ggplot2::coord_equal() 162 | grobs <- GeomText$draw_panel(data, panel_params, coord, parse = FALSE, check_overlap = FALSE) 163 | 164 | # msg("Done With => GeomPictogram::draw_panel()") 165 | 166 | ggname("geom_pictogram", grid::grobTree(children = grobs)) 167 | 168 | }, 169 | 170 | draw_key = draw_key_pictogram 171 | 172 | ) 173 | -------------------------------------------------------------------------------- /R/geom-rtile.R: -------------------------------------------------------------------------------- 1 | geom_rtile <- function(mapping = NULL, data = NULL, 2 | stat = "identity", position = "identity", 3 | radius = grid::unit(6, "pt"), 4 | ..., 5 | na.rm = FALSE, 6 | show.legend = NA, 7 | inherit.aes = TRUE) { 8 | ggplot2::layer( 9 | data = data, 10 | mapping = mapping, 11 | stat = stat, 12 | geom = GeomRtile, 13 | position = position, 14 | show.legend = show.legend, 15 | inherit.aes = inherit.aes, 16 | params = list( 17 | radius = radius, 18 | na.rm = na.rm, 19 | ... 20 | ) 21 | ) 22 | } 23 | 24 | GeomRtile <- ggplot2::ggproto("GeomRtile", GeomRrect, 25 | 26 | extra_params = c("na.rm", "width", "height"), 27 | 28 | setup_data = function(data, params) { 29 | data$width <- data$width %||% params$width %||% ggplot2::resolution(data$x, FALSE) 30 | data$height <- data$height %||% params$height %||% ggplot2::resolution(data$y, FALSE) 31 | 32 | transform(data, 33 | xmin = x - width / 2, xmax = x + width / 2, width = NULL, 34 | ymin = y - height / 2, ymax = y + height / 2, height = NULL 35 | ) 36 | }, 37 | 38 | default_aes = ggplot2::aes( 39 | fill = "grey20", colour = NA, size = 0.1, linetype = 1, alpha = NA 40 | ), 41 | 42 | required_aes = c("x", "y"), 43 | 44 | draw_key = ggplot2::draw_key_polygon 45 | 46 | ) 47 | -------------------------------------------------------------------------------- /R/geom-waffle.R: -------------------------------------------------------------------------------- 1 | draw_key_waffle <- function(data, params, size, ...) { 2 | 3 | # msg("Called => draw_key_waffle()") 4 | # 5 | # print(str(data, 1)) 6 | # print(str(params, 1)) 7 | # print(str(size, 1)) 8 | # print(str(list(...), 1)) 9 | 10 | grid::roundrectGrob( 11 | r = min(params$radius, unit(3, "pt")), 12 | default.units = "native", 13 | width = 0.9, height = 0.9, 14 | name = "lkey", 15 | gp = grid::gpar( 16 | col = params[["color"]][[1]] %l0% params[["colour"]][1] %l0% data[["colour"]][[1]] %l0% "#00000000", 17 | fill = alpha(data$fill %||% data$colour %||% "grey20", data$alpha), 18 | lty = data$linetype %||% 1 19 | ) 20 | ) 21 | } 22 | 23 | #' Waffle (Square pie chart) Geom 24 | #' 25 | #' There are two special/critical `aes()` mappings: 26 | #' - `fill` (so the geom knows which column to map the fills to) 27 | #' - `values` (which column you're mapping the filling for the squares with) 28 | #' 29 | #' @md 30 | #' @param mapping Set of aesthetic mappings created by `aes()` or 31 | #' `aes_()`. If specified and `inherit.aes = TRUE` (the 32 | #' default), it is combined with the default mapping at the top level of the 33 | #' plot. You must supply `mapping` if there is no plot mapping. 34 | #' @param n_rows how many rows should there be in the waffle chart? default is 10 35 | #' @param flip If `TRUE`, flip x and y coords. n_rows then becomes n_cols. 36 | #' Useful to achieve waffle column chart effect. Defaults is `FALSE`. 37 | #' @param make_proportional compute proportions from the raw values? (i.e. each 38 | #' value `n` will be replaced with `n`/`sum(n)`); default is `FALSE`. 39 | #' @param radius radius for round squares 40 | #' @param data The data to be displayed in this layer. There are three 41 | #' options: 42 | #' 43 | #' If `NULL`, the default, the data is inherited from the plot 44 | #' data as specified in the call to `ggplot()`. 45 | #' 46 | #' A `data.frame`, or other object, will override the plot 47 | #' data. All objects will be fortified to produce a data frame. See 48 | #' `fortify()` for which variables will be created. 49 | #' 50 | #' A `function` will be called with a single argument, 51 | #' the plot data. The return value must be a `data.frame.`, and 52 | #' will be used as the layer data. 53 | #' @param na.rm If `FALSE`, the default, missing values are removed with 54 | #' a warning. If `TRUE`, missing values are silently removed. 55 | #' @param show.legend logical. Should this layer be included in the legends? 56 | #' `NA`, the default, includes if any aesthetics are mapped. 57 | #' `FALSE` never includes, and `TRUE` always includes. 58 | #' It can also be a named logical vector to finely select the aesthetics to 59 | #' display. 60 | #' @param inherit.aes If `FALSE`, overrides the default aesthetics, 61 | #' rather than combining with them. This is most useful for helper functions 62 | #' that define both data and aesthetics and shouldn't inherit behaviour from 63 | #' the default plot specification, e.g. `borders()`. 64 | #' @param geom geom to use (default is "waffle") 65 | #' @param ... other arguments passed on to `layer()`. These are 66 | #' often aesthetics, used to set an aesthetic to a fixed value, like 67 | #' `color = "red"` or `size = 3`. They may also be parameters 68 | #' to the paired geom/stat. 69 | #' @export 70 | #' @examples 71 | #' data.frame( 72 | #' parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 73 | #' vals = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 74 | #' fct = c(rep("Thing 1", 3), rep("Thing 2", 3), rep("Thing 3", 3)) 75 | #' ) -> xdf 76 | #' 77 | #' ggplot(xdf, aes(fill = parts, values = vals)) + 78 | #' geom_waffle() + 79 | #' facet_wrap(~fct) 80 | geom_waffle <- function(mapping = NULL, data = NULL, 81 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 82 | na.rm = FALSE, show.legend = NA, 83 | radius = grid::unit(0, "npc"), 84 | inherit.aes = TRUE, ...) { 85 | 86 | # msg("Called => geom_waffle::geom_waffle()") 87 | # msg("Done With => geom_waffle::geom_waffle()") 88 | 89 | layer( 90 | stat = StatWaffle, 91 | data = data, 92 | mapping = mapping, 93 | geom = GeomWaffle, 94 | position = "identity", 95 | show.legend = show.legend, 96 | inherit.aes = inherit.aes, 97 | check.param = FALSE, 98 | params = list( 99 | na.rm = na.rm, 100 | n_rows = n_rows, 101 | make_proportional = make_proportional, 102 | flip = flip, 103 | radius = radius, 104 | ... 105 | ) 106 | ) 107 | } 108 | 109 | #' @rdname geom_waffle 110 | #' @export 111 | GeomWaffle <- ggplot2::ggproto( 112 | `_class` = "GeomWaffle", 113 | `_inherit` = GeomRtile, 114 | 115 | default_aes = ggplot2::aes( 116 | fill = NA, alpha = NA, colour = NA, 117 | size = 0.125, linetype = 1, width = NA, height = NA 118 | ), 119 | 120 | draw_group = function(self, data, panel_params, coord, 121 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 122 | radius = grid::unit(0, "npc")) { 123 | 124 | # msg("Called => GeomWaffle::draw_group()") 125 | 126 | coord <- ggplot2::coord_equal() 127 | grobs <- GeomRtile$draw_panel(data, panel_params, coord, radius) 128 | 129 | # msg("Done With => GeomWaffle::draw_group()") 130 | 131 | ggname("geom_waffle", grid::grobTree(children = grobs)) 132 | 133 | }, 134 | 135 | 136 | draw_panel = function(self, data, panel_params, coord, 137 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 138 | radius = grid::unit(0, "npc")) { 139 | 140 | # msg("Called => GeomWaffle::draw_panel()") 141 | 142 | coord <- ggplot2::coord_equal() 143 | 144 | # grid::gList( 145 | grobs <- GeomRtile$draw_panel(data, panel_params, coord, radius) 146 | # ) -> grobs 147 | 148 | # msg("Done With => GeomWaffle::draw_panel()") 149 | 150 | ggname("geom_waffle", grid::grobTree(children = grobs)) 151 | 152 | }, 153 | 154 | draw_key = draw_key_waffle 155 | 156 | ) 157 | -------------------------------------------------------------------------------- /R/iron.R: -------------------------------------------------------------------------------- 1 | #' Veritical, left-aligned layout for waffle plots 2 | #' 3 | #' Left-align the waffle plots by x-axis. Use the \code{pad} parameter in 4 | #' \code{waffle} to pad each plot to the max width (num of squares), otherwise 5 | #' the plots will be scaled. 6 | #' 7 | #' @param ... one or more waffle plots 8 | #' @export 9 | #' @examples 10 | #' parts <- c(80, 30, 20, 10) 11 | #' w1 <- waffle(parts, rows=8) 12 | #' w2 <- waffle(parts, rows=8) 13 | #' w3 <- waffle(parts, rows=8) 14 | #' # print chart 15 | #' ## iron(w1, w2, w3) 16 | iron <- function(...) { 17 | grob_list <- list(...) 18 | grid.newpage() 19 | grid.draw(do.call("rbind_gtable_max", lapply(grob_list, ggplotGrob))) 20 | } 21 | -------------------------------------------------------------------------------- /R/saved-sw.R: -------------------------------------------------------------------------------- 1 | # # @rdname geom_waffle 2 | # # @export 3 | # stat_waffle<- function(mapping = NULL, data = NULL, 4 | # n_rows = 10, make_proportional = FALSE, 5 | # na.rm = NA, show.legend = NA, 6 | # inherit.aes = TRUE, ...) { 7 | # 8 | # layer( 9 | # stat = StatWaffle, 10 | # data = data, 11 | # mapping = mapping, 12 | # geom = "waffle", 13 | # position = "identity", 14 | # show.legend = show.legend, 15 | # inherit.aes = inherit.aes, 16 | # params = list( 17 | # na.rm = na.rm, 18 | # n_rows = n_rows, 19 | # make_proportional = make_proportional, 20 | # ... 21 | # ) 22 | # ) 23 | # } 24 | # 25 | # # @rdname geom_waffle 26 | # # @export 27 | # StatWaffle <- ggplot2::ggproto( 28 | # `_class` = "StatWaffle", 29 | # `_inherit` = ggplot2::Stat, 30 | # 31 | # required_aes = c("fill", "values"), 32 | # 33 | # compute_layer = function(self, data, params, panels) { 34 | # 35 | # if (inherits(data[["fill"]], "factor")) { 36 | # flvls <- levels(data[["fill"]]) 37 | # } else { 38 | # flvls <- levels(factor(data[["fill"]])) 39 | # } 40 | # 41 | # p <- split(data, data$PANEL) 42 | # 43 | # lapply(p, function(.x) { 44 | # 45 | # parts_vec <- unlist(sapply(1:length(.x[["fill"]]), function(i) { 46 | # rep(as.character(.x[["fill"]][i]), .x[["values"]][i]) 47 | # })) 48 | # 49 | # pgrp_vec <- unlist(sapply(1:length(.x[["fill"]]), function(i) { 50 | # rep(.x$group, .x[["values"]][i]) 51 | # })) 52 | # 53 | # expand.grid( 54 | # y = 1:params$n_rows, 55 | # x = seq_len((ceiling(sum(.x[["values"]]) / params$n_rows)))#, 56 | # # stringsAsFactors = FALSE 57 | # ) -> tdf 58 | # 59 | # parts_vec <- c(parts_vec, rep(NA, nrow(tdf)-length(parts_vec))) 60 | # 61 | # # tdf$parts <- parts_vec 62 | # tdf[["values"]] <- NA 63 | # tdf[["fill"]] <- parts_vec 64 | # tdf[["PANEL"]] <- .x[["PANEL"]][1] 65 | # tdf[["group"]] <- 1:nrow(tdf) 66 | # 67 | # tdf <- tdf[sapply(tdf[["fill"]], function(x) !is.na(x)),] 68 | # 69 | # }) -> p 70 | # 71 | # p <- plyr::rbind.fill(p) 72 | # p[["fill"]] <- factor(p[["fill"]], levels=flvls) 73 | # 74 | # # print(str(p)) 75 | # 76 | # p 77 | # 78 | # }, 79 | # 80 | # compute_panel = function(self, data, scales, na.rm = FALSE, 81 | # n_rows = 10, make_proportional = FALSE) { 82 | # 83 | # # message("Called STAT compute_panel()") 84 | # 85 | # ggproto_parent(Stat, self)$compute_panel(data, scales, 86 | # n_rows = 10, 87 | # make_proportional = FALSE) 88 | # 89 | # } 90 | # 91 | # ) 92 | -------------------------------------------------------------------------------- /R/stat-waffle.R: -------------------------------------------------------------------------------- 1 | #' @rdname geom_waffle 2 | #' @export 3 | stat_waffle <- function(mapping = NULL, data = NULL, geom = "waffle", 4 | n_rows = 10, make_proportional = FALSE, flip = FALSE, 5 | radius = grid::unit(0, "npc"), 6 | na.rm = FALSE, show.legend = NA, 7 | inherit.aes = TRUE, ...) { 8 | 9 | # msg("Called => stat_waffle::stat_waffle()") 10 | # msg("Done With => stat_waffle::stat_waffle()") 11 | 12 | layer( 13 | stat = StatWaffle, 14 | data = data, 15 | mapping = mapping, 16 | geom = geom, 17 | position = "identity", 18 | show.legend = show.legend, 19 | inherit.aes = inherit.aes, 20 | check.param = FALSE, 21 | params = list( 22 | na.rm = na.rm, 23 | n_rows = n_rows, 24 | make_proportional = make_proportional, 25 | flip = flip, 26 | radius = radius, 27 | ... 28 | ) 29 | ) 30 | } 31 | 32 | #' @rdname geom_waffle 33 | #' @export 34 | StatWaffle <- ggplot2::ggproto( 35 | 36 | `_class` = "StatWaffle", 37 | `_inherit` = ggplot2::Stat, 38 | 39 | extra_params = c("na.rm", "n_rows", "make_proportional", "flip", "radius"), 40 | 41 | required_aes = c("fill", "values", "colour", "label"), 42 | 43 | setup_params = function(data, params) { 44 | # msg("Called => StatWaffle::setup_params()") 45 | # msg("Done With => StatWaffle::setup_params()") 46 | params 47 | }, 48 | 49 | setup_data = function(data, params) { 50 | 51 | # msg("Called => StatWaffle::setup_data()") 52 | # 53 | # print(str(data, 1)) 54 | # print(str(params, 1)) 55 | 56 | use <- if ("label" %in% names(data)) "label" else "fill" 57 | 58 | if (inherits(data[[use]], "factor")) { 59 | flvls <- levels(data[[use]]) 60 | } else { 61 | flvls <- levels(factor(data[[use]])) 62 | } 63 | 64 | if (inherits(data[["colour"]], "factor")) { 65 | clvls <- levels(data[["colour"]]) 66 | } else { 67 | clvls <- levels(factor(data[["colour"]])) 68 | } 69 | 70 | if (!("colour" %in% names(data))) { 71 | if ("colour" %in% names(params)) { 72 | data[["colour"]] <- params[["colour"]] 73 | } else { 74 | data[["colour"]] <- "white" 75 | } 76 | clvls <- levels(factor(data[["colour"]])) 77 | } else { 78 | if (any(is.na(as.character(data[["colour"]])))) { 79 | data[["colour"]] <- "white" 80 | clvls <- levels(factor(data[["colour"]])) 81 | } else { 82 | data[["colour"]] <- as.character(data[["colour"]]) 83 | } 84 | } 85 | 86 | # msg(" => StatWaffle::setup_data() : colour") 87 | # print(str(data, 1)) 88 | 89 | p <- split(data, data$PANEL) 90 | 91 | lapply(p, function(.x) { 92 | 93 | if (params[["make_proportional"]]) { 94 | .x[["values"]] <- .x[["values"]] / sum(.x[["values"]]) 95 | .x[["values"]] <- round_preserve_sum(.x[["values"]], digits = 2) 96 | .x[["values"]] <- as.integer(.x[["values"]] * 100) 97 | } 98 | 99 | parts_vec <- unlist(sapply(1:length(.x[[use]]), function(i) { 100 | rep(as.character(.x[[use]][i]), .x[["values"]][i]) 101 | })) 102 | 103 | pgrp_vec <- unlist(sapply(1:length(.x[[use]]), function(i) { 104 | rep(.x[["group"]], .x[["values"]][i]) 105 | })) 106 | 107 | # print(str(.x, 1)) 108 | 109 | colour_vec <- unlist(sapply(1:length(.x[[use]]), function(i) { 110 | rep(.x[["colour"]][i], .x[["values"]][i]) 111 | })) 112 | 113 | expand.grid( 114 | y = 1:params$n_rows, 115 | x = seq_len((ceiling(sum(.x[["values"]]) / params$n_rows)))#, 116 | # stringsAsFactors = FALSE 117 | ) -> tdf 118 | 119 | parts_vec <- c(parts_vec, rep(NA, nrow(tdf)-length(parts_vec))) 120 | colour_vec <- c(colour_vec, rep(NA, nrow(tdf)-length(colour_vec))) 121 | 122 | # tdf$parts <- parts_vec 123 | tdf[["values"]] <- NA 124 | tdf[["colour"]] <- colour_vec 125 | tdf[[use]] <- parts_vec 126 | tdf[["PANEL"]] <- .x[["PANEL"]][1] 127 | tdf[["group"]] <- 1:nrow(tdf) 128 | 129 | tdf <- tdf[sapply(tdf[[use]], function(x) !is.na(x)),] 130 | 131 | }) -> p 132 | 133 | p <- plyr::rbind.fill(p) 134 | p[[use]] <- factor(p[[use]], levels=flvls) 135 | p[["colour"]] <- factor(p[["colour"]], levels = clvls) 136 | 137 | # print(str(p, 1)) 138 | # 139 | # msg("Done With => StatWaffle::setup_data()") 140 | # data 141 | 142 | wdat <- p 143 | 144 | if (params$flip) { 145 | x_temp <- wdat$x 146 | wdat$x <- wdat$y 147 | wdat$y <- x_temp 148 | x_temp <- NULL 149 | } 150 | 151 | wdat$width <- wdat$width %||% params$width %||% ggplot2::resolution(wdat$x, FALSE) 152 | wdat$height <- wdat$height %||% params$height %||% ggplot2::resolution(wdat$y, FALSE) 153 | 154 | transform( 155 | wdat, 156 | xmin = x - width / 2, 157 | xmax = x + width / 2, 158 | width = NULL, 159 | ymin = y - height / 2, 160 | ymax = y + height / 2, 161 | height = NULL 162 | ) -> p 163 | 164 | p 165 | 166 | }, 167 | 168 | compute_layer = function(self, data, params, layout) { 169 | # msg("Called => StatWaffle::compute_layer()") 170 | # print(str(data, 1)) 171 | # print(str(params, 1)) 172 | # msg("Done With => StatWaffle::compute_layer()") 173 | data 174 | }, 175 | 176 | finish_layer = function(self, data, params) { 177 | # msg("Called => StatWaffle::finish_layer()") 178 | # msg("Done With => StatWaffle::finish_layer()") 179 | data 180 | }, 181 | 182 | compute_panel = function(self, data, scales, ...) { 183 | # msg("Called => StatWaffle::compute_panel()") 184 | # msg("Done With => StatWaffle::compute_panel()") 185 | data 186 | } 187 | 188 | ) 189 | -------------------------------------------------------------------------------- /R/utils.r: -------------------------------------------------------------------------------- 1 | round_preserve_sum <- function(x, digits = 0) { 2 | up <- 10^digits 3 | x <- x * up 4 | y <- floor(x) 5 | indices <- tail(order(x - y), round(sum(x)) - sum(y)) 6 | y[indices] <- y[indices] + 1 7 | y / up 8 | } 9 | 10 | 11 | is_missing_arg <- function(x) identical(x, quote(expr = )) 12 | 13 | # VIA: http://stackoverflow.com/q/13294952/1457051 14 | 15 | rbind_gtable_max <- function(...) { 16 | 17 | gtl <- list(...) 18 | 19 | stopifnot(all(sapply(gtl, is.gtable))) 20 | 21 | bind2 <- function (x, y) { 22 | 23 | stopifnot(ncol(x) == ncol(y)) 24 | 25 | if (nrow(x) == 0) return(y) 26 | if (nrow(y) == 0) return(x) 27 | 28 | y$layout$t <- y$layout$t + nrow(x) 29 | y$layout$b <- y$layout$b + nrow(x) 30 | x$layout <- rbind(x$layout, y$layout) 31 | 32 | x$heights <- insert_unit(x$heights, y$heights) 33 | x$rownames <- c(x$rownames, y$rownames) 34 | x$widths <- unit.pmax(x$widths, y$widths) 35 | x$grobs <- append(x$grobs, y$grobs) 36 | 37 | x 38 | 39 | } 40 | Reduce(bind2, gtl) 41 | 42 | } 43 | 44 | cbind_gtable_max <- function(...) { 45 | 46 | gtl <- list(...) 47 | 48 | stopifnot(all(sapply(gtl, is.gtable))) 49 | 50 | bind2 <- function (x, y) { 51 | 52 | stopifnot(nrow(x) == nrow(y)) 53 | 54 | if (ncol(x) == 0) return(y) 55 | if (ncol(y) == 0) return(x) 56 | 57 | y$layout$l <- y$layout$l + ncol(x) 58 | y$layout$r <- y$layout$r + ncol(x) 59 | x$layout <- rbind(x$layout, y$layout) 60 | 61 | x$widths <- insert_unit(x$widths, y$widths) 62 | x$colnames <- c(x$colnames, y$colnames) 63 | x$heights <- unit.pmax(x$heights, y$heights) 64 | x$grobs <- append(x$grobs, y$grobs) 65 | 66 | x 67 | 68 | } 69 | 70 | Reduce(bind2, gtl) 71 | 72 | } 73 | 74 | insert_unit <- function (x, values, after = length(x)) { 75 | 76 | lengx <- length(x) 77 | 78 | if (lengx == 0) return(values) 79 | if (length(values) == 0) return(x) 80 | 81 | if (after <= 0) { 82 | unit.c(values, x) 83 | } else if (after >= lengx) { 84 | unit.c(x, values) 85 | } else { 86 | unit.c(x[1L:after], values, x[(after + 1L):lengx]) 87 | } 88 | 89 | } 90 | 91 | # Name ggplot grid object 92 | # Convenience function to name grid objects 93 | # 94 | # @keyword internal 95 | ggname <- function(prefix, grob) { 96 | grob$name <- grid::grobName(grob, prefix) 97 | grob 98 | } 99 | 100 | "%||%" <- function(a, b) { if (!is.null(a)) a else b } 101 | "%l0%" <- function(a, b) { if (length(a)) a else b } 102 | 103 | .pt <- ggplot2::.pt -------------------------------------------------------------------------------- /R/waffle-enhance.R: -------------------------------------------------------------------------------- 1 | #' Waffle chart theme cruft remover that can be used with any other theme 2 | #' 3 | #' Removes: 4 | #' 5 | #' - panel grid 6 | #' - all axis text 7 | #' - all axis ticks 8 | #' - all axis titles 9 | #' 10 | #' @md 11 | #' @export 12 | theme_enhance_waffle<- function() { 13 | 14 | ret <- theme(panel.grid = element_blank()) 15 | ret <- ret + theme(axis.text = element_blank()) 16 | ret <- ret + theme(axis.text.x = element_blank()) 17 | ret <- ret + theme(axis.text.y = element_blank()) 18 | ret <- ret + theme(axis.title = element_blank()) 19 | ret <- ret + theme(axis.title.x = element_blank()) 20 | ret <- ret + theme(axis.title.x.top = element_blank()) 21 | ret <- ret + theme(axis.title.x.bottom = element_blank()) 22 | ret <- ret + theme(axis.title.y = element_blank()) 23 | ret <- ret + theme(axis.title.y.left = element_blank()) 24 | ret <- ret + theme(axis.title.y.right = element_blank()) 25 | 26 | ret 27 | 28 | } -------------------------------------------------------------------------------- /R/waffle-package.R: -------------------------------------------------------------------------------- 1 | #' A package to make waffle charts (square pie charts) in R. 2 | #' 3 | #' For glyphs:\cr 4 | #' \cr 5 | #' Font Awesome by Dave Gandy - http://fontawesome.io\cr 6 | #' License: SIL OFL 1.1\cr 7 | #' URL: http://scripts.sil.org/OFL 8 | #' 9 | #' @name waffle-package 10 | #' @docType package 11 | #' @import gridExtra 12 | #' @import stringr 13 | #' @import curl 14 | #' @import DT 15 | #' @import htmlwidgets 16 | #' @importFrom plyr a_ply 17 | #' @importFrom gtable is.gtable 18 | #' @importFrom RColorBrewer brewer.pal 19 | #' @importFrom ggplot2 ggplot geom_tile scale_fill_manual guides geom_tile ggplotGrob 20 | #' @importFrom ggplot2 geom_point geom_text scale_color_manual guides theme labs 21 | #' @importFrom ggplot2 scale_x_continuous scale_y_continuous coord_equal theme_bw 22 | #' @importFrom ggplot2 aes guide_legend element_rect element_blank element_text layer 23 | #' @importFrom ggplot2 discrete_scale alpha 24 | #' @importFrom grid arrow unit grid.newpage grid.draw unit.c unit.pmax unit.pmin 25 | #' @importFrom grid textGrob gpar grobTree roundrectGrob 26 | #' @importFrom extrafont ttf_import font_import choose_font 27 | #' @importFrom stats setNames 28 | #' @importFrom utils tail 29 | #' @importFrom rlang is_missing 30 | NULL 31 | -------------------------------------------------------------------------------- /R/waffle.R: -------------------------------------------------------------------------------- 1 | #' Make waffle (square pie) charts 2 | #' 3 | #' Given a named vector or a data frame, this function will return a ggplot object that 4 | #' represents a waffle chart of the values. The individual values will be 5 | #' summed up and each that will be the total number of squares in the grid. 6 | #' You can perform appropriate value transformation ahead of time to get the 7 | #' desired waffle layout/effect. 8 | #' 9 | #' If a data frame is used, the first two columns should contain the desired names 10 | #' and the values, respectively. 11 | #' 12 | #' If the vector is not named or only partially named, capital letters will be 13 | #' used instead. 14 | #' 15 | #' It is highly suggested that you limit the number of elements 16 | #' to plot, just like you should if you ever got wasted and decided that a 17 | #' regular pie chart was a good thing to create and then decide to be totally 18 | #' evil and make one to pollute this beautiful world of ours. 19 | #' 20 | #' Chart title and x-axis labels are optional, especially if you'll just be 21 | #' exporting to another program for use/display. 22 | #' 23 | #' If you specify a string (vs `FALSE`) to `use_glyph` the function 24 | #' will map the input to a Font Awesome glyph name and use that glyph for the 25 | #' tile instead of a block (making it more like an isotype pictogram than a 26 | #' waffle chart). You'll need to install Font Awesome 5 and use 27 | #' the `extrafont` package to 28 | #' be able to use Font Awesome 5 glyphs. Sizing is also up to the user since 29 | #' fonts do not automatically scale with graphic resize. 30 | #' 31 | #' Glyph idea inspired by Ruben C. Arslan (@@_r_c_a) 32 | #' 33 | #' @md 34 | #' @note You MUST use the Font Awesome 5 fonts bundled with the package. 35 | #' See [install_fa_fonts()]. 36 | #' @param parts named vector of values or a data frame to use for the chart 37 | #' @param rows number of rows of blocks 38 | #' @param keep keep factor levels (i.e. for consistent legends across waffle plots) 39 | #' @param xlab text for below the chart. Highly suggested this be used to 40 | #' give the "1 sq == xyz" relationship if it's not obvious 41 | #' @param title chart title 42 | #' @param colors exactly the number of colors as values in `parts.` 43 | #' If omitted, Color Brewer "Set2" colors are used. 44 | #' @param size width of the separator between blocks (defaults to `2`) 45 | #' @param flip flips x & y axes 46 | #' @param reverse reverses the order of the data 47 | #' @param equal by default, waffle uses `coord_equal`; this can cause 48 | #' layout problems, so you an use this to disable it if you are using 49 | #' ggsave or knitr to control output sizes (or manually sizing the chart) 50 | #' @param pad how many blocks to right-pad the grid with 51 | #' @param use_glyph use specified glyph; if using built-in Font Awesome, can be 52 | #' the glyph name; otherwise, it must be the unicode glyph from the custom 53 | #' font the caller is using. 54 | #' @param glyph_size size of the Font Awesome font 55 | #' @param glyph_font,glyph_font_family if `use_glyph` is not `FALSE`, 56 | #' the `gplyph_font` will be looked up in the font database and 57 | #' the `glpyph_font_family` used as the `family` parameter to ggplot for 58 | #' font display since fonts in R, Python and anythign that relies on 59 | #' legacy font C libraries are woefully messed up. You may need to adjust 60 | #' either of these "font" parameters depending on your system & OS version 61 | #' due to the fact that font names are different even between OS versions 62 | #' (sometimes).\cr 63 | #' \cr 64 | #' The package comes with Font Awesome and helpers for it. Use of any other fonts 65 | #' requires the caller to be familiar with using fonts in R. NOT ALL FONTS 66 | #' will work with ggplot2 and definitely not under all graphics devices 67 | #' for ggplot2. 68 | #' @param legend_pos position of legend 69 | #' @export 70 | #' @examples 71 | #' parts <- c(80, 30, 20, 10) 72 | #' waffle(parts, rows=8) 73 | #' 74 | #' parts <- data.frame( 75 | #' names = LETTERS[1:4], 76 | #' vals = c(80, 30, 20, 10) 77 | #' ) 78 | #' 79 | #' waffle(parts, rows=8) 80 | #' 81 | #' # library(extrafont) 82 | #' # waffle(parts, rows=8, use_glyph="shield") 83 | #' 84 | #' parts <- c(One=80, Two=30, Three=20, Four=10) 85 | #' chart <- waffle(parts, rows=8) 86 | #' # print(chart) 87 | waffle <- function(parts, rows=10, keep=TRUE, xlab=NULL, title=NULL, colors=NA, 88 | size=2, flip=FALSE, reverse=FALSE, equal=TRUE, pad=0, 89 | use_glyph = FALSE, 90 | glyph_size = 12, 91 | glyph_font = "Font Awesome 5 Free Solid", 92 | glyph_font_family = "FontAwesome5Free-Solid", 93 | legend_pos = "right") { 94 | 95 | if (inherits(parts, "data.frame")) { 96 | stats::setNames( 97 | unlist(parts[, 2], use.names = FALSE), 98 | unlist(parts[, 1], use.names = FALSE) 99 | ) -> parts 100 | } 101 | 102 | # fill in any missing names 103 | part_names <- names(parts) 104 | if (length(part_names) < length(parts)) { 105 | part_names <- c(part_names, LETTERS[1:length(parts) - length(part_names)]) 106 | } 107 | 108 | names(parts) <- part_names 109 | 110 | # use Set2 if no colors are specified 111 | if (all(is.na(colors))) colors <- suppressWarnings(brewer.pal(length(parts), "Set2")) 112 | 113 | # make one big vector of all the bits 114 | parts_vec <- unlist(sapply(1:length(parts), function(i) { 115 | rep(names(parts)[i], parts[i]) 116 | })) 117 | 118 | if (reverse) parts_vec <- rev(parts_vec) 119 | 120 | # setup the data frame for geom_rect 121 | dat <- expand.grid(y = 1:rows, x = seq_len(pad + (ceiling(sum(parts) / rows)))) 122 | 123 | # add NAs if needed to fill in the "rectangle" 124 | dat$value <- c(parts_vec, rep(NA, nrow(dat) - length(parts_vec))) 125 | 126 | if (!inherits(use_glyph, "logical")) { 127 | 128 | if (length(use_glyph) == 1L) { 129 | 130 | if (grepl("wesom", glyph_font)) { 131 | fontlab <- .fa_unicode[.fa_unicode[["name"]] == use_glyph, "unicode"] 132 | dat$fontlab <- c( 133 | rep(fontlab, length(parts_vec)), 134 | rep("", nrow(dat) - length(parts_vec) 135 | # rep(NA, nrow(dat) - length(parts_vec) 136 | ) 137 | ) 138 | } else { 139 | dat$fontlab <- c( 140 | rep(use_glyph, length(parts_vec)), 141 | rep("", nrow(dat) - length(parts_vec) 142 | # rep(NA, nrow(dat) - length(parts_vec) 143 | ) 144 | ) 145 | } 146 | 147 | } else if (length(use_glyph) == length(parts)) { 148 | 149 | if (grepl("wesom", glyph_font)) { 150 | fontlab <- .fa_unicode[.fa_unicode[["name"]] %in% use_glyph, "unicode"] 151 | # fontlab <- .fa_unicode[use_glyph] 152 | dat$fontlab <- c( 153 | fontlab[as.numeric(factor(parts_vec, levels = names(parts)))], 154 | rep("", nrow(dat) - length(parts_vec)) 155 | # rep(NA, nrow(dat) - length(parts_vec)) 156 | ) 157 | } else { 158 | dat$fontlab <- c( 159 | use_glyph[as.numeric(factor(parts_vec, levels = names(parts)))], 160 | # rep(NA, nrow(dat) - length(parts_vec)) 161 | rep("", nrow(dat) - length(parts_vec)) 162 | ) 163 | } 164 | 165 | } else if (length(use_glyph) == length(parts_vec)) { 166 | 167 | if (grepl("wesom", glyph_font)) { 168 | fontlab <- .fa_unicode[.fa_unicode[["name"]] %in% use_glyph, "unicode"] 169 | dat$fontlab <- c(fontlab, rep(NA, nrow(dat) - length(parts_vec))) 170 | } else { 171 | dat$fontlab <- c(use_glyph, rep(NA, nrow(dat) - length(parts_vec))) 172 | } 173 | 174 | } else { 175 | stop("'use_glyph' must have length 1, length(parts), or sum(parts)") 176 | } 177 | } 178 | 179 | dat$value <- ifelse(is.na(dat$value), " ", dat$value) 180 | 181 | if (" " %in% dat$value) part_names <- c(part_names, " ") 182 | if (" " %in% dat$value) colors <- c(colors, "#00000000") 183 | 184 | dat$value <- factor(dat$value, levels = part_names) 185 | 186 | gg <- ggplot(dat, aes(x = x, y = y)) 187 | 188 | if (flip) gg <- ggplot(dat, aes(x = y, y = x)) 189 | 190 | gg <- gg + theme_bw() 191 | 192 | # make the plot 193 | 194 | if (inherits(use_glyph, "logical")) { 195 | 196 | gg <- gg + geom_tile(aes(fill = value), color = "white", size = size) 197 | 198 | gg <- gg + scale_fill_manual( 199 | name = "", 200 | values = colors, 201 | label = part_names, 202 | na.value = "white", 203 | drop = !keep 204 | ) 205 | 206 | gg <- gg + guides(fill = guide_legend(override.aes = list(colour = "#00000000"))) 207 | 208 | gg <- gg + theme(legend.background = 209 | element_rect(fill = "#00000000", color = "#00000000")) 210 | 211 | gg <- gg + theme(legend.key = 212 | element_rect(fill = "#00000000", color = "#00000000")) 213 | 214 | } else { 215 | 216 | if (extrafont::choose_font(glyph_font, quiet = TRUE) == "") { 217 | stop( 218 | sprintf( 219 | "Font [%s] not found. Please install it and use extrafont to make it available to R", 220 | glyph_font 221 | ), 222 | call. = FALSE 223 | ) 224 | } 225 | 226 | load_fontawesome() 227 | 228 | gg <- gg + geom_tile( 229 | color = "#00000000", fill = "#00000000", size = size, 230 | alpha = 0, show.legend = FALSE 231 | ) 232 | 233 | gg <- gg + geom_point( 234 | aes(color = value), fill = "#00000000", size = 0, 235 | show.legend = TRUE 236 | ) 237 | 238 | gg <- gg + geom_text( 239 | aes(color = value, label = fontlab), 240 | family = glyph_font_family, 241 | size = glyph_size, 242 | show.legend = FALSE 243 | ) 244 | 245 | gg <- gg + scale_color_manual( 246 | name = NULL, 247 | values = colors, 248 | labels = part_names, 249 | drop = !keep 250 | ) 251 | 252 | gg <- gg + guides(color = 253 | guide_legend(override.aes = list(shape = 15, size = 7))) 254 | 255 | gg <- gg + theme(legend.background = 256 | element_rect(fill = "#00000000", color = "#00000000")) 257 | 258 | gg <- gg + theme(legend.key = element_rect(color = "#00000000")) 259 | } 260 | 261 | gg <- gg + labs(x = xlab, y = NULL, title = title) 262 | gg <- gg + scale_x_continuous(expand = c(0, 0)) 263 | gg <- gg + scale_y_continuous(expand = c(0, 0)) 264 | 265 | if (equal) gg <- gg + coord_equal() 266 | 267 | gg <- gg + theme(panel.grid = element_blank()) 268 | gg <- gg + theme(panel.border = element_blank()) 269 | gg <- gg + theme(panel.background = element_blank()) 270 | gg <- gg + theme(panel.spacing = unit(0, "null")) 271 | 272 | gg <- gg + theme(axis.text = element_blank()) 273 | gg <- gg + theme(axis.title.x = element_text(size = 10)) 274 | gg <- gg + theme(axis.ticks = element_blank()) 275 | gg <- gg + theme(axis.line = element_blank()) 276 | gg <- gg + theme(axis.ticks.length = unit(0, "null")) 277 | 278 | gg <- gg + theme(plot.title = element_text(size = 18)) 279 | 280 | gg <- gg + theme(plot.background = element_blank()) 281 | gg <- gg + theme(panel.spacing = unit(c(0, 0, 0, 0), "null")) 282 | 283 | gg <- gg + theme(legend.position = legend_pos) 284 | 285 | gg 286 | 287 | } 288 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | load_fontawesome <- function() { 2 | suppressWarnings( 3 | suppressMessages( 4 | extrafont::font_import( 5 | paths = system.file("fonts", package = "waffle"), 6 | recursive = FALSE, 7 | prompt = FALSE 8 | ) 9 | ) 10 | ) 11 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 🧇 waffle 3 | 4 | Create Waffle Chart Visualizations 5 | 6 | ## Description 7 | 8 | Square pie charts (a.k.a. waffle charts) can be used to communicate 9 | parts of a whole for categorical quantities. To emulate the percentage 10 | view of a pie chart, a 10x10 grid should be used with each square 11 | representing 1% of the total. Modern uses of waffle charts do not 12 | necessarily adhere to this rule and can be created with a grid of any 13 | rectangular shape. Best practices suggest keeping the number of 14 | categories small, just as should be done when creating pie charts. Tools 15 | are provided to create waffle charts as well as stitch them together, 16 | and to use glyphs for making isotype pictograms. 17 | 18 | It uses ggplot2 and returns a ggplot2 object. 19 | 20 | ## What’s Inside the Tin 21 | 22 | The following functions are implemented: 23 | 24 | - `waffle`: Make waffle (square pie) charts 25 | 26 | - `draw_key_pictogram`: Legend builder for pictograms 27 | 28 | - `fa_grep`: Search Font Awesome glyph names for a pattern 29 | 30 | - `fa_list`: List all Font Awesome glyphs 31 | 32 | - `fa5_brand`: Font Awesome 5 Brand 33 | 34 | - `fa5_solid`: Font Awesome 5 Solid 35 | 36 | - `geom_pictogram`: Pictogram Geom 37 | 38 | - `geom_waffle`: Waffle (Square pie chart) Geom 39 | 40 | - `install_fa_fonts`: Install Font Awesome 5 Fonts 41 | 42 | - `iron`: Veritical, left-aligned layout for waffle plots 43 | 44 | - `scale_label_pictogram`: Used with geom_pictogram() to map Font 45 | Awesome fonts to labels 46 | 47 | - `theme_enhance_waffle`: Waffle chart theme cruft remover that can be 48 | used with any other theme 49 | 50 | ## Installation 51 | 52 | ``` r 53 | install.packages("waffle") # NOTE: CRAN version is 0.7.0 54 | # or 55 | remotes::install_github("hrbrmstr/waffle") 56 | ``` 57 | 58 | NOTE: To use the ‘remotes’ install options you will need to have the 59 | [{remotes} package](https://github.com/r-lib/remotes) installed. 60 | 61 | ## Usage 62 | 63 | ``` r 64 | library(waffle) 65 | library(magrittr) 66 | library(hrbrthemes) 67 | library(ggplot2) 68 | library(dplyr) 69 | library(waffle) 70 | 71 | # current verison 72 | packageVersion("waffle") 73 | ## [1] '1.0.2' 74 | ``` 75 | 76 | ### Some new bits up first 77 | 78 | ``` r 79 | data.frame( 80 | parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 81 | vals = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 82 | col = rep(c("navy", "black", "maroon"), 3), 83 | fct = c( 84 | rep("Thing 1", 3), 85 | rep("Thing 2", 3), 86 | rep("Thing 3", 3) 87 | ) 88 | ) -> xdf 89 | 90 | xdf %>% 91 | count(parts, wt = vals) %>% 92 | ggplot( 93 | aes(fill = parts, values = n) 94 | ) + 95 | geom_waffle( 96 | n_rows = 20, 97 | size = 0.33, 98 | colour = "white", 99 | flip = TRUE 100 | ) + 101 | scale_fill_manual( 102 | name = NULL, 103 | values = c("#a40000", "#c68958", "#ae6056"), 104 | labels = c("Fruit", "Sammich", "Pizza") 105 | ) + 106 | coord_equal() + 107 | theme_ipsum_rc(grid="") + 108 | theme_enhance_waffle() 109 | ``` 110 | 111 | 112 | 113 | ``` r 114 | 115 | xdf %>% 116 | count(parts, wt = vals) %>% 117 | ggplot( 118 | aes(label = parts, values = n) 119 | ) + 120 | geom_pictogram( 121 | n_rows = 10, 122 | aes(colour = parts), 123 | flip = TRUE, 124 | make_proportional = TRUE 125 | ) + 126 | scale_color_manual( 127 | name = NULL, 128 | values = c("#a40000", "#c68958", "#ae6056"), 129 | labels = c("Fruit", "Sammich", "Pizza") 130 | ) + 131 | scale_label_pictogram( 132 | name = NULL, 133 | values = c("apple-alt", "bread-slice", "pizza-slice"), 134 | labels = c("Fruit", "Sammich", "Pizza") 135 | ) + 136 | coord_equal() + 137 | theme_ipsum_rc(grid="") + 138 | theme_enhance_waffle() + 139 | theme( 140 | legend.key.height = unit(2.25, "line"), 141 | legend.text = element_text(size = 10, hjust = 0, vjust = 0.75) 142 | ) 143 | ``` 144 | 145 | 146 | 147 | ``` r 148 | 149 | xdf %>% 150 | count(parts, wt = vals) %>% 151 | ggplot( 152 | aes(label = parts, values = n) 153 | ) + 154 | geom_pictogram( 155 | n_rows = 20, 156 | size = 6, 157 | aes(colour = parts), 158 | flip = TRUE, 159 | family = "FontAwesome5Brands-Regular" 160 | ) + 161 | scale_color_manual( 162 | name = NULL, 163 | values = c("#073f9c", "black", "#f34323"), 164 | labels = c("BitBucket", "GitHub", "Other") 165 | ) + 166 | scale_label_pictogram( 167 | name = NULL, 168 | values = c("bitbucket", "github", "git-alt"), 169 | labels = c("BitBucket", "GitHub", "Other") 170 | ) + 171 | coord_equal() + 172 | theme_ipsum_rc(grid="") + 173 | theme_enhance_waffle() + 174 | theme( 175 | legend.text = element_text(hjust = 0, vjust = 1) 176 | ) 177 | ``` 178 | 179 | 180 | 181 | ### Geoms! 182 | 183 | ``` r 184 | library(hrbrthemes) 185 | library(waffle) 186 | library(tidyverse) 187 | 188 | tibble( 189 | parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 190 | values = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 191 | fct = c(rep("Thing 1", 3), rep("Thing 2", 3), rep("Thing 3", 3)) 192 | ) -> xdf 193 | 194 | ggplot( 195 | data = xdf, 196 | aes(fill=parts, values=values) 197 | ) + 198 | geom_waffle( 199 | color = "white", 200 | size = 1.125, 201 | n_rows = 6 202 | ) + 203 | facet_wrap(~fct, ncol=1) + 204 | scale_x_discrete( 205 | expand = c(0,0,0,0) 206 | ) + 207 | scale_y_discrete( 208 | expand = c(0,0,0,0) 209 | ) + 210 | ggthemes::scale_fill_tableau(name=NULL) + 211 | coord_equal() + 212 | labs( 213 | title = "Faceted Waffle Geoms" 214 | ) + 215 | theme_ipsum_rc(grid="") + 216 | theme_enhance_waffle() 217 | ``` 218 | 219 | 220 | 221 | ### Waffle Bar Charts with scales! 222 | 223 | ``` r 224 | library(dplyr) 225 | library(waffle) 226 | 227 | storms %>% 228 | filter(year >= 2010) %>% 229 | count(year, status) -> storms_df 230 | 231 | ggplot( 232 | data = storms_df, 233 | aes(fill = status, values = n) 234 | ) + 235 | geom_waffle( 236 | color = "white", 237 | size = .25, 238 | n_rows = 10, 239 | flip = TRUE 240 | ) + 241 | facet_wrap( 242 | ~year, 243 | nrow = 1, 244 | strip.position = "bottom" 245 | ) + 246 | scale_x_discrete() + 247 | scale_y_continuous( 248 | labels = function(x) x * 10, # make this multiplier the same as n_rows 249 | expand = c(0,0) 250 | ) + 251 | ggthemes::scale_fill_tableau(name=NULL) + 252 | coord_equal() + 253 | labs( 254 | x = "Year", y = "Count", 255 | title = "Faceted Waffle Bar Chart", 256 | subtitle = "{dplyr} storms data" 257 | ) + 258 | theme_minimal( 259 | base_family = "Roboto Condensed" 260 | ) + 261 | theme( 262 | panel.grid = element_blank(), 263 | axis.ticks.y = element_line() 264 | ) + 265 | guides( 266 | fill = guide_legend(reverse = TRUE) 267 | ) 268 | ``` 269 | 270 | 272 | 273 | ### Basic example 274 | 275 | ``` r 276 | parts <- c(80, 30, 20, 10) 277 | waffle(parts, rows = 8) 278 | ``` 279 | 280 | 281 | 282 | ### Use a data frame 283 | 284 | ``` r 285 | parts <- data.frame( 286 | names = LETTERS[1:4], 287 | vals = c(80, 30, 20, 10) 288 | ) 289 | 290 | waffle(parts, rows = 8) 291 | ``` 292 | 293 | 294 | 295 | ### Slightly more complex example 296 | 297 | ``` r 298 | c( 299 | `Un-breached\nUS Population` = (318 - 11 - 79), 300 | `Premera` = 11, 301 | `Anthem` = 79 302 | ) -> parts 303 | ``` 304 | 305 | ``` r 306 | waffle( 307 | parts = parts, 308 | rows = 8, 309 | size = 1, 310 | colors = c("#969696", "#1879bf", "#009bda"), 311 | legend_pos = "bottom" 312 | ) 313 | ``` 314 | 315 | **Health records breaches as fraction of US Population** 316 | 317 | 318 | 319 | One square == 1m ppl 320 | 321 | ``` r 322 | waffle( 323 | parts = parts / 10, 324 | rows = 3, 325 | colors = c("#969696", "#1879bf", "#009bda") 326 | ) 327 | ``` 328 | 329 | **Health records breaches as fraction of US Population** 330 | 331 | 332 | 333 | (One square == 10m ppl) 334 | 335 | ``` r 336 | library(extrafont) 337 | 338 | waffle( 339 | parts = parts / 10, 340 | rows = 3, 341 | colors = c("#969696", "#1879bf", "#009bda"), 342 | use_glyph = "medkit", 343 | size = 8 344 | ) + 345 | expand_limits( 346 | y = c(0, 4) 347 | ) 348 | ``` 349 | 350 | 351 | 352 | ### Replicating an old favourite 353 | 354 | ![](https://graphics8.nytimes.com/images/2008/07/20/business/20debtgraphic.jpg) 355 | 356 | Via: 357 | 358 | ``` r 359 | c( 360 | `Mortgage\n($84,911)` = 84911, 361 | `Auto and\ntuition loans\n($14,414)` = 14414, 362 | `Home equity loans\n($10,062)` = 10062, 363 | `Credit Cards\n($8,565)` = 8565 364 | ) -> savings 365 | ``` 366 | 367 | ``` r 368 | waffle( 369 | parts = savings / 392, 370 | rows = 7, 371 | size = 0.5, 372 | legend_pos = "bottom", 373 | colors = c("#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf") 374 | ) 375 | ``` 376 | 377 | **Average Household Savings Each Year** 378 | 379 | 380 | 381 | (1 square == \$392) 382 | 383 | ### More replication 384 | 385 | Similar to 386 | 387 | ``` r 388 | professional <- c(`Male` = 44, `Female (56%)` = 56) 389 | ``` 390 | 391 | ``` r 392 | waffle( 393 | parts = professional, 394 | rows = 10, 395 | size = 0.5, 396 | colors = c("#af9139", "#544616") 397 | ) 398 | ``` 399 | 400 | ### Keeps factor by default levels now 401 | 402 | With: 403 | 404 | ``` r 405 | iron( 406 | waffle( 407 | parts = c(thing1 = 0, thing2 = 100), 408 | rows = 5 409 | ), 410 | waffle( 411 | parts = c(thing1 = 25, thing2 = 75), 412 | rows = 5 413 | ) 414 | ) 415 | ``` 416 | 417 | 418 | 419 | Without (you can disable this via `keep` parameter now): 420 | 421 | ``` r 422 | iron( 423 | waffle( 424 | parts = c(thing1 = 0, thing2 = 100), 425 | rows = 5, 426 | keep = FALSE 427 | ), 428 | waffle( 429 | parts = c(thing1 = 25, thing2 = 75), 430 | rows = 5, 431 | keep = FALSE 432 | ) 433 | ) 434 | ``` 435 | 436 | 437 | 438 | **Professional Workforce Makeup** 439 | 440 | 441 | 442 | Iron example (left-align & padding for multiple plots) 443 | 444 | ``` r 445 | pain.adult.1997 <- c(`YOY (406)` = 406, `Adult (24)` = 24) 446 | 447 | waffle( 448 | parts = pain.adult.1997 / 2, 449 | rows = 7, 450 | size = 0.5, 451 | colors = c("#c7d4b6", "#a3aabd"), 452 | title = "Paine Run Brook Trout Abundance (1997)", 453 | xlab = "1 square = 2 fish", pad = 3 454 | ) -> A 455 | 456 | pine.adult.1997 <- c(`YOY (221)` = 221, `Adult (143)` = 143) 457 | 458 | waffle( 459 | parts = pine.adult.1997 / 2, 460 | rows = 7, 461 | size = 0.5, 462 | colors = c("#c7d4b6", "#a3aabd"), 463 | title = "Piney River Brook Trout Abundance (1997)", 464 | xlab = "1 square = 2 fish", pad = 8 465 | ) -> B 466 | 467 | stan.adult.1997 <- c(`YOY (270)` = 270, `Adult (197)` = 197) 468 | 469 | waffle( 470 | parts = stan.adult.1997 / 2, 471 | rows = 7, 472 | size = 0.5, 473 | colors = c("#c7d4b6", "#a3aabd"), 474 | title = "Staunton River Trout Abundance (1997)", 475 | xlab = "1 square = 2 fish" 476 | ) -> C 477 | 478 | iron(A, B, C) 479 | ``` 480 | 481 | 482 | 483 | ## Package Code Metrics 484 | 485 | ``` r 486 | cloc::cloc_pkg_md() 487 | ``` 488 | 489 | | Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | 490 | |:-----|---------:|-----:|----:|-----:|------------:|-----:|---------:|-----:| 491 | | R | 14 | 0.44 | 624 | 0.35 | 218 | 0.36 | 439 | 0.38 | 492 | | Rmd | 2 | 0.06 | 255 | 0.15 | 88 | 0.14 | 139 | 0.12 | 493 | | SUM | 16 | 0.50 | 879 | 0.50 | 306 | 0.50 | 578 | 0.50 | 494 | 495 | {cloc} 📦 metrics for waffle 496 | 497 | ## Code of Conduct 498 | 499 | Please note that this project is released with a [Contributor Code of 500 | Conduct](CONDUCT.md). By participating in this project you agree to 501 | abide by its terms. 502 | -------------------------------------------------------------------------------- /README.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | format: gfm 3 | editor_options: 4 | chunk_output_type: console 5 | --- 6 | 7 | ```{r, setup, include = FALSE} 8 | knitr::opts_chunk$set( 9 | echo = TRUE, 10 | collapse = TRUE, 11 | message = FALSE, 12 | warning = FALSE, 13 | error = FALSE, 14 | fig.retina = 2 15 | ) 16 | ``` 17 | 18 | # 🧇 waffle 19 | 20 | Create Waffle Chart Visualizations 21 | 22 | ## Description 23 | 24 | Square pie charts (a.k.a. waffle charts) can be used to communicate parts of a whole for categorical quantities. To emulate the percentage view of a pie chart, a 10x10 grid should be used with each square representing 1% of the total. Modern uses of waffle charts do not necessarily adhere to this rule and can be created with a grid of any rectangular shape. Best practices suggest keeping the number of categories small, just as should be done when creating pie charts. Tools are provided to create waffle charts as well as stitch them together, and to use glyphs for making isotype pictograms. 25 | 26 | It uses ggplot2 and returns a ggplot2 object. 27 | 28 | ## What's Inside the Tin 29 | 30 | The following functions are implemented: 31 | 32 | - `waffle`: Make waffle (square pie) charts 33 | ```{r ingredients, results='asis', echo=FALSE, cache=FALSE} 34 | hrbrpkghelpr::describe_ingredients() 35 | ``` 36 | 37 | ## Installation 38 | 39 | ```{r install-ex, results='asis', echo = FALSE, cache=FALSE} 40 | hrbrpkghelpr::install_block() 41 | ``` 42 | 43 | ```{r s2, include=FALSE} 44 | options(width = 120) 45 | ``` 46 | 47 | ## Usage 48 | 49 | ```{r s3, cache=FALSE} 50 | library(waffle) 51 | library(magrittr) 52 | library(hrbrthemes) 53 | library(ggplot2) 54 | library(dplyr) 55 | library(waffle) 56 | 57 | # current verison 58 | packageVersion("waffle") 59 | ``` 60 | 61 | ### Some new bits up first 62 | 63 | ```{r new-bits, fig.width=8, fig.height=6} 64 | data.frame( 65 | parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 66 | vals = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 67 | col = rep(c("navy", "black", "maroon"), 3), 68 | fct = c( 69 | rep("Thing 1", 3), 70 | rep("Thing 2", 3), 71 | rep("Thing 3", 3) 72 | ) 73 | ) -> xdf 74 | 75 | xdf %>% 76 | count(parts, wt = vals) %>% 77 | ggplot( 78 | aes(fill = parts, values = n) 79 | ) + 80 | geom_waffle( 81 | n_rows = 20, 82 | size = 0.33, 83 | colour = "white", 84 | flip = TRUE 85 | ) + 86 | scale_fill_manual( 87 | name = NULL, 88 | values = c("#a40000", "#c68958", "#ae6056"), 89 | labels = c("Fruit", "Sammich", "Pizza") 90 | ) + 91 | coord_equal() + 92 | theme_ipsum_rc(grid="") + 93 | theme_enhance_waffle() 94 | 95 | xdf %>% 96 | count(parts, wt = vals) %>% 97 | ggplot( 98 | aes(label = parts, values = n) 99 | ) + 100 | geom_pictogram( 101 | n_rows = 10, 102 | aes(colour = parts), 103 | flip = TRUE, 104 | make_proportional = TRUE 105 | ) + 106 | scale_color_manual( 107 | name = NULL, 108 | values = c("#a40000", "#c68958", "#ae6056"), 109 | labels = c("Fruit", "Sammich", "Pizza") 110 | ) + 111 | scale_label_pictogram( 112 | name = NULL, 113 | values = c("apple-alt", "bread-slice", "pizza-slice"), 114 | labels = c("Fruit", "Sammich", "Pizza") 115 | ) + 116 | coord_equal() + 117 | theme_ipsum_rc(grid="") + 118 | theme_enhance_waffle() + 119 | theme( 120 | legend.key.height = unit(2.25, "line"), 121 | legend.text = element_text(size = 10, hjust = 0, vjust = 0.75) 122 | ) 123 | 124 | xdf %>% 125 | count(parts, wt = vals) %>% 126 | ggplot( 127 | aes(label = parts, values = n) 128 | ) + 129 | geom_pictogram( 130 | n_rows = 20, 131 | size = 6, 132 | aes(colour = parts), 133 | flip = TRUE, 134 | family = "FontAwesome5Brands-Regular" 135 | ) + 136 | scale_color_manual( 137 | name = NULL, 138 | values = c("#073f9c", "black", "#f34323"), 139 | labels = c("BitBucket", "GitHub", "Other") 140 | ) + 141 | scale_label_pictogram( 142 | name = NULL, 143 | values = c("bitbucket", "github", "git-alt"), 144 | labels = c("BitBucket", "GitHub", "Other") 145 | ) + 146 | coord_equal() + 147 | theme_ipsum_rc(grid="") + 148 | theme_enhance_waffle() + 149 | theme( 150 | legend.text = element_text(hjust = 0, vjust = 1) 151 | ) 152 | ``` 153 | 154 | ### Geoms! 155 | 156 | ```{r geoms, fig.width=6, fig.height=8, fig.retina=2} 157 | library(hrbrthemes) 158 | library(waffle) 159 | library(tidyverse) 160 | 161 | tibble( 162 | parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 163 | values = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 164 | fct = c(rep("Thing 1", 3), rep("Thing 2", 3), rep("Thing 3", 3)) 165 | ) -> xdf 166 | 167 | ggplot( 168 | data = xdf, 169 | aes(fill=parts, values=values) 170 | ) + 171 | geom_waffle( 172 | color = "white", 173 | size = 1.125, 174 | n_rows = 6 175 | ) + 176 | facet_wrap(~fct, ncol=1) + 177 | scale_x_discrete( 178 | expand = c(0,0,0,0) 179 | ) + 180 | scale_y_discrete( 181 | expand = c(0,0,0,0) 182 | ) + 183 | ggthemes::scale_fill_tableau(name=NULL) + 184 | coord_equal() + 185 | labs( 186 | title = "Faceted Waffle Geoms" 187 | ) + 188 | theme_ipsum_rc(grid="") + 189 | theme_enhance_waffle() 190 | ``` 191 | 192 | ### Waffle Bar Charts with scales! 193 | 194 | ```{r waffle-bars, fig.retina=2} 195 | library(dplyr) 196 | library(waffle) 197 | 198 | storms %>% 199 | filter(year >= 2010) %>% 200 | count(year, status) -> storms_df 201 | 202 | ggplot( 203 | data = storms_df, 204 | aes(fill = status, values = n) 205 | ) + 206 | geom_waffle( 207 | color = "white", 208 | size = .25, 209 | n_rows = 10, 210 | flip = TRUE 211 | ) + 212 | facet_wrap( 213 | ~year, 214 | nrow = 1, 215 | strip.position = "bottom" 216 | ) + 217 | scale_x_discrete() + 218 | scale_y_continuous( 219 | labels = function(x) x * 10, # make this multiplier the same as n_rows 220 | expand = c(0,0) 221 | ) + 222 | ggthemes::scale_fill_tableau(name=NULL) + 223 | coord_equal() + 224 | labs( 225 | x = "Year", y = "Count", 226 | title = "Faceted Waffle Bar Chart", 227 | subtitle = "{dplyr} storms data" 228 | ) + 229 | theme_minimal( 230 | base_family = "Roboto Condensed" 231 | ) + 232 | theme( 233 | panel.grid = element_blank(), 234 | axis.ticks.y = element_line() 235 | ) + 236 | guides( 237 | fill = guide_legend(reverse = TRUE) 238 | ) 239 | ``` 240 | 241 | 242 | ### Basic example 243 | 244 | ```{r fig0, fig.width=6, fig.height=2.5} 245 | parts <- c(80, 30, 20, 10) 246 | waffle(parts, rows = 8) 247 | ``` 248 | 249 | ### Use a data frame 250 | 251 | ```{r fig1, fig.width=6, fig.height=2.5} 252 | parts <- data.frame( 253 | names = LETTERS[1:4], 254 | vals = c(80, 30, 20, 10) 255 | ) 256 | 257 | waffle(parts, rows = 8) 258 | ``` 259 | 260 | ### Slightly more complex example 261 | 262 | ```{r s4} 263 | c( 264 | `Un-breached\nUS Population` = (318 - 11 - 79), 265 | `Premera` = 11, 266 | `Anthem` = 79 267 | ) -> parts 268 | ``` 269 | 270 | ```{r t1, eval=FALSE} 271 | waffle( 272 | parts = parts, 273 | rows = 8, 274 | size = 1, 275 | colors = c("#969696", "#1879bf", "#009bda"), 276 | legend_pos = "bottom" 277 | ) 278 | ``` 279 | 280 | **Health records breaches as fraction of US Population** 281 | ```{r fig2, echo=FALSE, fig.width=6, fig.height=1.75} 282 | waffle( 283 | parts = parts, 284 | rows = 8, 285 | size = 1, 286 | legend_pos = "bottom", 287 | colors = c("#969696", "#1879bf", "#009bda") 288 | ) 289 | ``` 290 | 291 | One square == 1m ppl 292 | 293 | ```{r t2, eval=FALSE} 294 | waffle( 295 | parts = parts / 10, 296 | rows = 3, 297 | colors = c("#969696", "#1879bf", "#009bda") 298 | ) 299 | ``` 300 | 301 | **Health records breaches as fraction of US Population** 302 | ```{r fig3, echo=FALSE, fig.width=6, fig.height=2} 303 | waffle( 304 | parts = parts / 10, 305 | rows = 3, 306 | colors = c("#969696", "#1879bf", "#009bda") 307 | ) 308 | ``` 309 | 310 | (One square == 10m ppl) 311 | 312 | ```{r medkit0, eval=FALSE} 313 | library(extrafont) 314 | 315 | waffle( 316 | parts = parts / 10, 317 | rows = 3, 318 | colors = c("#969696", "#1879bf", "#009bda"), 319 | use_glyph = "medkit", 320 | size = 8 321 | ) + 322 | expand_limits( 323 | y = c(0, 4) 324 | ) 325 | ``` 326 | 327 | ```{r medkit, echo=FALSE, fig.width=6, fig.height=2} 328 | library(extrafont) 329 | 330 | waffle( 331 | parts = parts / 10, 332 | rows = 3, 333 | colors = c("#969696", "#1879bf", "#009bda"), 334 | use_glyph = "medkit", 335 | glyph_size = 8 336 | ) + 337 | expand_limits( 338 | y = c(0, 4) 339 | ) 340 | ``` 341 | 342 | ### Replicating an old favourite 343 | 344 | ![](https://graphics8.nytimes.com/images/2008/07/20/business/20debtgraphic.jpg) 345 | 346 | Via: 347 | 348 | 349 | ```{r s5} 350 | c( 351 | `Mortgage\n($84,911)` = 84911, 352 | `Auto and\ntuition loans\n($14,414)` = 14414, 353 | `Home equity loans\n($10,062)` = 10062, 354 | `Credit Cards\n($8,565)` = 8565 355 | ) -> savings 356 | ``` 357 | 358 | ```{r fig4, eval=FALSE} 359 | waffle( 360 | parts = savings / 392, 361 | rows = 7, 362 | size = 0.5, 363 | legend_pos = "bottom", 364 | colors = c("#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf") 365 | ) 366 | ``` 367 | 368 | 369 | **Average Household Savings Each Year** 370 | ```{r fig4a, echo=FALSE, fig.width=8, fig.height=2.5} 371 | waffle( 372 | parts = savings / 392, 373 | rows = 7, 374 | size = 0.5, 375 | legend_pos = "bottom", 376 | colors = c("#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf") 377 | ) 378 | ``` 379 | 380 | (1 square == $392) 381 | 382 | ### More replication 383 | 384 | Similar to 385 | 386 | ```{r s6} 387 | professional <- c(`Male` = 44, `Female (56%)` = 56) 388 | ``` 389 | 390 | ```{r t5, eval=FALSE} 391 | waffle( 392 | parts = professional, 393 | rows = 10, 394 | size = 0.5, 395 | colors = c("#af9139", "#544616") 396 | ) 397 | ``` 398 | 399 | ### Keeps factor by default levels now 400 | 401 | With: 402 | 403 | ```{r fct, fig.height=3, fig.width=6} 404 | iron( 405 | waffle( 406 | parts = c(thing1 = 0, thing2 = 100), 407 | rows = 5 408 | ), 409 | waffle( 410 | parts = c(thing1 = 25, thing2 = 75), 411 | rows = 5 412 | ) 413 | ) 414 | ``` 415 | 416 | Without (you can disable this via `keep` parameter now): 417 | 418 | ```{r no_fct, fig.height=3, fig.width=6} 419 | iron( 420 | waffle( 421 | parts = c(thing1 = 0, thing2 = 100), 422 | rows = 5, 423 | keep = FALSE 424 | ), 425 | waffle( 426 | parts = c(thing1 = 25, thing2 = 75), 427 | rows = 5, 428 | keep = FALSE 429 | ) 430 | ) 431 | ``` 432 | 433 | **Professional Workforce Makeup** 434 | 435 | ```{r f5, echo=FALSE, fig.height=3, fig.width=4} 436 | waffle( 437 | parts = professional, 438 | rows = 10, 439 | size = 0.5, 440 | colors = c("#af9139", "#544616") 441 | ) 442 | ``` 443 | 444 | Iron example (left-align & padding for multiple plots) 445 | 446 | ```{r f8, fig.height=6, fig.width=7} 447 | pain.adult.1997 <- c(`YOY (406)` = 406, `Adult (24)` = 24) 448 | 449 | waffle( 450 | parts = pain.adult.1997 / 2, 451 | rows = 7, 452 | size = 0.5, 453 | colors = c("#c7d4b6", "#a3aabd"), 454 | title = "Paine Run Brook Trout Abundance (1997)", 455 | xlab = "1 square = 2 fish", pad = 3 456 | ) -> A 457 | 458 | pine.adult.1997 <- c(`YOY (221)` = 221, `Adult (143)` = 143) 459 | 460 | waffle( 461 | parts = pine.adult.1997 / 2, 462 | rows = 7, 463 | size = 0.5, 464 | colors = c("#c7d4b6", "#a3aabd"), 465 | title = "Piney River Brook Trout Abundance (1997)", 466 | xlab = "1 square = 2 fish", pad = 8 467 | ) -> B 468 | 469 | stan.adult.1997 <- c(`YOY (270)` = 270, `Adult (197)` = 197) 470 | 471 | waffle( 472 | parts = stan.adult.1997 / 2, 473 | rows = 7, 474 | size = 0.5, 475 | colors = c("#c7d4b6", "#a3aabd"), 476 | title = "Staunton River Trout Abundance (1997)", 477 | xlab = "1 square = 2 fish" 478 | ) -> C 479 | 480 | iron(A, B, C) 481 | ``` 482 | 483 | ## Package Code Metrics 484 | 485 | ```{r cloc} 486 | cloc::cloc_pkg_md() 487 | ``` 488 | 489 | ## Code of Conduct 490 | 491 | Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. -------------------------------------------------------------------------------- /README_cache/commonmark/__packages: -------------------------------------------------------------------------------- 1 | ggplot2 2 | waffle 3 | magrittr 4 | hrbrthemes 5 | dplyr 6 | tidyverse 7 | tibble 8 | tidyr 9 | readr 10 | purrr 11 | stringr 12 | forcats 13 | lubridate 14 | extrafont 15 | -------------------------------------------------------------------------------- /README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.RData -------------------------------------------------------------------------------- /README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f5_03d5bae8450bdaadd13ea6f1ab4a6065.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.RData -------------------------------------------------------------------------------- /README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/f8_cfd690625c28c35b29c8d938974bd88b.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fct_d5131e99fe673745f977578f10ca4f48.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig0_b53874c78d0daf5e69442798ed0e9957.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig1_fd8c7375634d9a3080bf76b1210ae135.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig2_3e1d897a35fd64a9b04f809a167a7b22.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig3_21436c60eef6e30e58acec0b7bc25f8b.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4_01ca1b499c0a5d6ca4c1a7a593a82338.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.RData -------------------------------------------------------------------------------- /README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/fig4a_cea4386fc158b50d4f068678a41ab9cd.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.RData -------------------------------------------------------------------------------- /README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/geoms_d324c5a7bdbfed2f829ee8446dfca165.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.RData -------------------------------------------------------------------------------- /README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit0_b81d40f05aea16dff4fa3b419e1880cf.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.RData -------------------------------------------------------------------------------- /README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/medkit_e2b0af9f0792c7bc6e315f773241d501.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.RData -------------------------------------------------------------------------------- /README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/no_fct_42840b53bbaf9ee76ab713ef9ad6e208.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.RData -------------------------------------------------------------------------------- /README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s2_f3fdec98ad58fa63b580d9d640ea59be.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.RData -------------------------------------------------------------------------------- /README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s4_6cbe77ac6c30f0d75903003ad6256901.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.RData -------------------------------------------------------------------------------- /README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s5_c4483722b97efa986ba51ccfd73914e8.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.RData -------------------------------------------------------------------------------- /README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/s6_1341d57d8f06bd280d326384360c3733.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.RData -------------------------------------------------------------------------------- /README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t1_bb7c040bc8777672fefe54885238ee4d.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.RData -------------------------------------------------------------------------------- /README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t2_f824a7f8d7299ec29da066a637c33377.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.RData -------------------------------------------------------------------------------- /README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/t5_b88afd9700b946468787378af40761ed.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.RData -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-1_4828a517c6e06c8c59b96d2574d9c635.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.RData -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-2_bea0cd1c0d8434e92aefa949e2471809.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.RData -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/unnamed-chunk-3_53c23b892f9bcd1d15b15bc012b24ff1.rdx -------------------------------------------------------------------------------- /README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.RData -------------------------------------------------------------------------------- /README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdb -------------------------------------------------------------------------------- /README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_cache/commonmark/waffle-bars_e3bb5bfed66837bf7c6ed124e7003061.rdx -------------------------------------------------------------------------------- /README_files/figure-commonmark/f5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/f5-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/f8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/f8-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fct-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fct-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fig0-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fig0-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fig1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fig1-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fig2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fig2-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fig3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fig3-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/fig4a-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/fig4a-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/geoms-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/geoms-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/medkit-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/medkit-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/new-bits-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/new-bits-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/new-bits-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/new-bits-2.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/new-bits-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/new-bits-3.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/no_fct-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/no_fct-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-1-2.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-1-3.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/unnamed-chunk-2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/unnamed-chunk-2-3.png -------------------------------------------------------------------------------- /README_files/figure-commonmark/waffle-bars-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/README_files/figure-commonmark/waffle-bars-1.png -------------------------------------------------------------------------------- /inst/COPYRIGHTS: -------------------------------------------------------------------------------- 1 | The {waffle} pacakge is GPL-2 as stated in the DESCRIPTION. 2 | 3 | The included Font Awesome 5 fonts in inst/json along with the JSON representation 4 | of them in inst/json have the following license coverage: 5 | 6 | Font Awesome Free License 7 | ------------------------- 8 | 9 | Font Awesome Free is free, open source, and GPL friendly. You can use it for 10 | commercial projects, open source projects, or really almost whatever you want. 11 | Full Font Awesome Free license: https://fontawesome.com/license/free. 12 | 13 | # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) 14 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons 15 | packaged as SVG and JS file types. 16 | 17 | # Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL) 18 | In the Font Awesome Free download, the SIL OFL license applies to all icons 19 | packaged as web and desktop font files. 20 | 21 | # Code: MIT License (https://opensource.org/licenses/MIT) 22 | In the Font Awesome Free download, the MIT license applies to all non-font and 23 | non-icon files. 24 | 25 | # Attribution 26 | Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font 27 | Awesome Free files already contain embedded comments with sufficient 28 | attribution, so you shouldn't need to do anything additional when using these 29 | files normally. 30 | 31 | We've kept attribution comments terse, so we ask that you do not actively work 32 | to remove them from files, especially code. They're a great way for folks to 33 | learn about Font Awesome. 34 | 35 | # Brand Icons 36 | All brand icons are trademarks of their respective owners. The use of these 37 | trademarks does not indicate endorsement of the trademark holder by Font 38 | Awesome, nor vice versa. **Please do not use brand logos for any purpose except 39 | to represent the company, product, or service to which they refer.** -------------------------------------------------------------------------------- /inst/extdat/fadf.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/inst/extdat/fadf.rds -------------------------------------------------------------------------------- /inst/fonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/inst/fonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /inst/fonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/inst/fonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /inst/json/icons.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hrbrmstr/waffle/767875bf15f0982f5deb6ca3be1b99b830d2b074/inst/json/icons.json.gz -------------------------------------------------------------------------------- /man/draw_key_pictogram.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/geom-pictogram.R 3 | \name{draw_key_pictogram} 4 | \alias{draw_key_pictogram} 5 | \title{Legend builder for pictograms} 6 | \usage{ 7 | draw_key_pictogram(data, params, size) 8 | } 9 | \arguments{ 10 | \item{data, params, size}{legend key things} 11 | } 12 | \description{ 13 | Legend builder for pictograms 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/fa5_brand.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fontawesome.R 3 | \docType{data} 4 | \name{fa5_brand} 5 | \alias{fa5_brand} 6 | \title{Font Awesome 5 Brand} 7 | \format{ 8 | An object of class \code{character} of length 1. 9 | } 10 | \usage{ 11 | fa5_brand 12 | } 13 | \description{ 14 | `fa5_brand` is shorthand for "`FontAwesome5Brands-Regular`" 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/fa5_solid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fontawesome.R 3 | \docType{data} 4 | \name{fa5_solid} 5 | \alias{fa5_solid} 6 | \title{Font Awesome 5 Solid} 7 | \format{ 8 | An object of class \code{character} of length 1. 9 | } 10 | \usage{ 11 | fa5_solid 12 | } 13 | \description{ 14 | `fa5_solid` is shorthand for "`FontAwesome5Free-Solid`" 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/fa_grep.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fontawesome.R 3 | \name{fa_grep} 4 | \alias{fa_grep} 5 | \title{Search Font Awesome glyph names for a pattern} 6 | \usage{ 7 | fa_grep(pattern) 8 | } 9 | \arguments{ 10 | \item{pattern}{pattern to search for in the names of Font Awesome fonts} 11 | } 12 | \description{ 13 | Search Font Awesome glyph names for a pattern 14 | } 15 | -------------------------------------------------------------------------------- /man/fa_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fontawesome.R 3 | \name{fa_list} 4 | \alias{fa_list} 5 | \title{List all Font Awesome glyphs} 6 | \usage{ 7 | fa_list() 8 | } 9 | \description{ 10 | List all Font Awesome glyphs 11 | } 12 | -------------------------------------------------------------------------------- /man/geom_pictogram.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/geom-pictogram.R 3 | \docType{data} 4 | \name{geom_pictogram} 5 | \alias{geom_pictogram} 6 | \alias{GeomPictogram} 7 | \title{Pictogram Geom} 8 | \format{ 9 | An object of class \code{GeomPictogram} (inherits from \code{GeomText}, \code{Geom}, \code{ggproto}, \code{gg}) of length 5. 10 | } 11 | \usage{ 12 | geom_pictogram( 13 | mapping = NULL, 14 | data = NULL, 15 | n_rows = 10, 16 | make_proportional = FALSE, 17 | flip = FALSE, 18 | ..., 19 | na.rm = FALSE, 20 | show.legend = NA, 21 | inherit.aes = TRUE 22 | ) 23 | 24 | GeomPictogram 25 | } 26 | \arguments{ 27 | \item{mapping}{Set of aesthetic mappings created by \code{aes()} or 28 | \code{aes_()}. If specified and \code{inherit.aes = TRUE} (the 29 | default), it is combined with the default mapping at the top level of the 30 | plot. You must supply \code{mapping} if there is no plot mapping.} 31 | 32 | \item{data}{The data to be displayed in this layer. There are three 33 | options: 34 | 35 | If \code{NULL}, the default, the data is inherited from the plot 36 | data as specified in the call to \code{ggplot()}. 37 | 38 | A \code{data.frame}, or other object, will override the plot 39 | data. All objects will be fortified to produce a data frame. See 40 | \code{fortify()} for which variables will be created. 41 | 42 | A \code{function} will be called with a single argument, 43 | the plot data. The return value must be a \code{data.frame.}, and 44 | will be used as the layer data.} 45 | 46 | \item{n_rows}{how many rows should there be in the waffle chart? default is 10} 47 | 48 | \item{make_proportional}{compute proportions from the raw values? (i.e. each 49 | value \code{n} will be replaced with \code{n}/\code{sum(n)}); default is \code{FALSE}.} 50 | 51 | \item{flip}{If \code{TRUE}, flip x and y coords. n_rows then becomes n_cols. 52 | Useful to achieve waffle column chart effect. Defaults is \code{FALSE}.} 53 | 54 | \item{...}{other arguments passed on to \code{layer()}. These are 55 | often aesthetics, used to set an aesthetic to a fixed value, like 56 | \code{color = "red"} or \code{size = 3}. They may also be parameters 57 | to the paired geom/stat.} 58 | 59 | \item{na.rm}{If \code{FALSE}, the default, missing values are removed with 60 | a warning. If \code{TRUE}, missing values are silently removed.} 61 | 62 | \item{show.legend}{logical. Should this layer be included in the legends? 63 | \code{NA}, the default, includes if any aesthetics are mapped. 64 | \code{FALSE} never includes, and \code{TRUE} always includes. 65 | It can also be a named logical vector to finely select the aesthetics to 66 | display.} 67 | 68 | \item{inherit.aes}{If \code{FALSE}, overrides the default aesthetics, 69 | rather than combining with them. This is most useful for helper functions 70 | that define both data and aesthetics and shouldn't inherit behaviour from 71 | the default plot specification, e.g. \code{borders()}.} 72 | } 73 | \description{ 74 | There are two special/critical \code{aes()} mappings: 75 | \itemize{ 76 | \item \code{label} (so the geom knows which column to map the glyphs to) 77 | \item \code{values} (which column you're mapping the filling for the squares with) 78 | } 79 | } 80 | \keyword{datasets} 81 | -------------------------------------------------------------------------------- /man/geom_waffle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/geom-waffle.R, R/stat-waffle.R 3 | \docType{data} 4 | \name{geom_waffle} 5 | \alias{geom_waffle} 6 | \alias{GeomWaffle} 7 | \alias{stat_waffle} 8 | \alias{StatWaffle} 9 | \title{Waffle (Square pie chart) Geom} 10 | \format{ 11 | An object of class \code{GeomWaffle} (inherits from \code{GeomRtile}, \code{GeomRrect}, \code{Geom}, \code{ggproto}, \code{gg}) of length 5. 12 | 13 | An object of class \code{StatWaffle} (inherits from \code{Stat}, \code{ggproto}, \code{gg}) of length 8. 14 | } 15 | \usage{ 16 | geom_waffle( 17 | mapping = NULL, 18 | data = NULL, 19 | n_rows = 10, 20 | make_proportional = FALSE, 21 | flip = FALSE, 22 | na.rm = FALSE, 23 | show.legend = NA, 24 | radius = grid::unit(0, "npc"), 25 | inherit.aes = TRUE, 26 | ... 27 | ) 28 | 29 | GeomWaffle 30 | 31 | stat_waffle( 32 | mapping = NULL, 33 | data = NULL, 34 | geom = "waffle", 35 | n_rows = 10, 36 | make_proportional = FALSE, 37 | flip = FALSE, 38 | radius = grid::unit(0, "npc"), 39 | na.rm = FALSE, 40 | show.legend = NA, 41 | inherit.aes = TRUE, 42 | ... 43 | ) 44 | 45 | StatWaffle 46 | } 47 | \arguments{ 48 | \item{mapping}{Set of aesthetic mappings created by \code{aes()} or 49 | \code{aes_()}. If specified and \code{inherit.aes = TRUE} (the 50 | default), it is combined with the default mapping at the top level of the 51 | plot. You must supply \code{mapping} if there is no plot mapping.} 52 | 53 | \item{data}{The data to be displayed in this layer. There are three 54 | options: 55 | 56 | If \code{NULL}, the default, the data is inherited from the plot 57 | data as specified in the call to \code{ggplot()}. 58 | 59 | A \code{data.frame}, or other object, will override the plot 60 | data. All objects will be fortified to produce a data frame. See 61 | \code{fortify()} for which variables will be created. 62 | 63 | A \code{function} will be called with a single argument, 64 | the plot data. The return value must be a \code{data.frame.}, and 65 | will be used as the layer data.} 66 | 67 | \item{n_rows}{how many rows should there be in the waffle chart? default is 10} 68 | 69 | \item{make_proportional}{compute proportions from the raw values? (i.e. each 70 | value \code{n} will be replaced with \code{n}/\code{sum(n)}); default is \code{FALSE}.} 71 | 72 | \item{flip}{If \code{TRUE}, flip x and y coords. n_rows then becomes n_cols. 73 | Useful to achieve waffle column chart effect. Defaults is \code{FALSE}.} 74 | 75 | \item{na.rm}{If \code{FALSE}, the default, missing values are removed with 76 | a warning. If \code{TRUE}, missing values are silently removed.} 77 | 78 | \item{show.legend}{logical. Should this layer be included in the legends? 79 | \code{NA}, the default, includes if any aesthetics are mapped. 80 | \code{FALSE} never includes, and \code{TRUE} always includes. 81 | It can also be a named logical vector to finely select the aesthetics to 82 | display.} 83 | 84 | \item{radius}{radius for round squares} 85 | 86 | \item{inherit.aes}{If \code{FALSE}, overrides the default aesthetics, 87 | rather than combining with them. This is most useful for helper functions 88 | that define both data and aesthetics and shouldn't inherit behaviour from 89 | the default plot specification, e.g. \code{borders()}.} 90 | 91 | \item{...}{other arguments passed on to \code{layer()}. These are 92 | often aesthetics, used to set an aesthetic to a fixed value, like 93 | \code{color = "red"} or \code{size = 3}. They may also be parameters 94 | to the paired geom/stat.} 95 | 96 | \item{geom}{geom to use (default is "waffle")} 97 | } 98 | \description{ 99 | There are two special/critical \code{aes()} mappings: 100 | \itemize{ 101 | \item \code{fill} (so the geom knows which column to map the fills to) 102 | \item \code{values} (which column you're mapping the filling for the squares with) 103 | } 104 | } 105 | \examples{ 106 | data.frame( 107 | parts = factor(rep(month.abb[1:3], 3), levels=month.abb[1:3]), 108 | vals = c(10, 20, 30, 6, 14, 40, 30, 20, 10), 109 | fct = c(rep("Thing 1", 3), rep("Thing 2", 3), rep("Thing 3", 3)) 110 | ) -> xdf 111 | 112 | ggplot(xdf, aes(fill = parts, values = vals)) + 113 | geom_waffle() + 114 | facet_wrap(~fct) 115 | } 116 | \keyword{datasets} 117 | -------------------------------------------------------------------------------- /man/install_fa_fonts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/fontawesome.R 3 | \name{install_fa_fonts} 4 | \alias{install_fa_fonts} 5 | \title{Install Font Awesome 5 Fonts} 6 | \usage{ 7 | install_fa_fonts() 8 | } 9 | \description{ 10 | Install Font Awesome 5 Fonts 11 | } 12 | -------------------------------------------------------------------------------- /man/iron.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/iron.R 3 | \name{iron} 4 | \alias{iron} 5 | \title{Veritical, left-aligned layout for waffle plots} 6 | \usage{ 7 | iron(...) 8 | } 9 | \arguments{ 10 | \item{...}{one or more waffle plots} 11 | } 12 | \description{ 13 | Left-align the waffle plots by x-axis. Use the \code{pad} parameter in 14 | \code{waffle} to pad each plot to the max width (num of squares), otherwise 15 | the plots will be scaled. 16 | } 17 | \examples{ 18 | parts <- c(80, 30, 20, 10) 19 | w1 <- waffle(parts, rows=8) 20 | w2 <- waffle(parts, rows=8) 21 | w3 <- waffle(parts, rows=8) 22 | # print chart 23 | ## iron(w1, w2, w3) 24 | } 25 | -------------------------------------------------------------------------------- /man/scale_label_pictogram.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/geom-pictogram.R 3 | \name{scale_label_pictogram} 4 | \alias{scale_label_pictogram} 5 | \title{Used with geom_pictogram() to map Font Awesome fonts to labels} 6 | \usage{ 7 | scale_label_pictogram(..., values, aesthetics = "label") 8 | } 9 | \arguments{ 10 | \item{...}{dots} 11 | 12 | \item{values}{values} 13 | 14 | \item{aesthetics}{aesthetics} 15 | } 16 | \description{ 17 | Used with geom_pictogram() to map Font Awesome fonts to labels 18 | } 19 | -------------------------------------------------------------------------------- /man/theme_enhance_waffle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waffle-enhance.R 3 | \name{theme_enhance_waffle} 4 | \alias{theme_enhance_waffle} 5 | \title{Waffle chart theme cruft remover that can be used with any other theme} 6 | \usage{ 7 | theme_enhance_waffle() 8 | } 9 | \description{ 10 | Removes: 11 | } 12 | \details{ 13 | \itemize{ 14 | \item panel grid 15 | \item all axis text 16 | \item all axis ticks 17 | \item all axis titles 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /man/waffle-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waffle-package.R 3 | \docType{package} 4 | \name{waffle-package} 5 | \alias{waffle-package} 6 | \title{A package to make waffle charts (square pie charts) in R.} 7 | \description{ 8 | For glyphs:\cr 9 | \cr 10 | Font Awesome by Dave Gandy - http://fontawesome.io\cr 11 | License: SIL OFL 1.1\cr 12 | URL: http://scripts.sil.org/OFL 13 | } 14 | -------------------------------------------------------------------------------- /man/waffle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waffle.R 3 | \name{waffle} 4 | \alias{waffle} 5 | \title{Make waffle (square pie) charts} 6 | \usage{ 7 | waffle( 8 | parts, 9 | rows = 10, 10 | keep = TRUE, 11 | xlab = NULL, 12 | title = NULL, 13 | colors = NA, 14 | size = 2, 15 | flip = FALSE, 16 | reverse = FALSE, 17 | equal = TRUE, 18 | pad = 0, 19 | use_glyph = FALSE, 20 | glyph_size = 12, 21 | glyph_font = "Font Awesome 5 Free Solid", 22 | glyph_font_family = "FontAwesome5Free-Solid", 23 | legend_pos = "right" 24 | ) 25 | } 26 | \arguments{ 27 | \item{parts}{named vector of values or a data frame to use for the chart} 28 | 29 | \item{rows}{number of rows of blocks} 30 | 31 | \item{keep}{keep factor levels (i.e. for consistent legends across waffle plots)} 32 | 33 | \item{xlab}{text for below the chart. Highly suggested this be used to 34 | give the "1 sq == xyz" relationship if it's not obvious} 35 | 36 | \item{title}{chart title} 37 | 38 | \item{colors}{exactly the number of colors as values in \code{parts.} 39 | If omitted, Color Brewer "Set2" colors are used.} 40 | 41 | \item{size}{width of the separator between blocks (defaults to \code{2})} 42 | 43 | \item{flip}{flips x & y axes} 44 | 45 | \item{reverse}{reverses the order of the data} 46 | 47 | \item{equal}{by default, waffle uses \code{coord_equal}; this can cause 48 | layout problems, so you an use this to disable it if you are using 49 | ggsave or knitr to control output sizes (or manually sizing the chart)} 50 | 51 | \item{pad}{how many blocks to right-pad the grid with} 52 | 53 | \item{use_glyph}{use specified glyph; if using built-in Font Awesome, can be 54 | the glyph name; otherwise, it must be the unicode glyph from the custom 55 | font the caller is using.} 56 | 57 | \item{glyph_size}{size of the Font Awesome font} 58 | 59 | \item{glyph_font, glyph_font_family}{if \code{use_glyph} is not \code{FALSE}, 60 | the \code{gplyph_font} will be looked up in the font database and 61 | the \code{glpyph_font_family} used as the \code{family} parameter to ggplot for 62 | font display since fonts in R, Python and anythign that relies on 63 | legacy font C libraries are woefully messed up. You may need to adjust 64 | either of these "font" parameters depending on your system & OS version 65 | due to the fact that font names are different even between OS versions 66 | (sometimes).\cr 67 | \cr 68 | The package comes with Font Awesome and helpers for it. Use of any other fonts 69 | requires the caller to be familiar with using fonts in R. NOT ALL FONTS 70 | will work with ggplot2 and definitely not under all graphics devices 71 | for ggplot2.} 72 | 73 | \item{legend_pos}{position of legend} 74 | } 75 | \description{ 76 | Given a named vector or a data frame, this function will return a ggplot object that 77 | represents a waffle chart of the values. The individual values will be 78 | summed up and each that will be the total number of squares in the grid. 79 | You can perform appropriate value transformation ahead of time to get the 80 | desired waffle layout/effect. 81 | } 82 | \details{ 83 | If a data frame is used, the first two columns should contain the desired names 84 | and the values, respectively. 85 | 86 | If the vector is not named or only partially named, capital letters will be 87 | used instead. 88 | 89 | It is highly suggested that you limit the number of elements 90 | to plot, just like you should if you ever got wasted and decided that a 91 | regular pie chart was a good thing to create and then decide to be totally 92 | evil and make one to pollute this beautiful world of ours. 93 | 94 | Chart title and x-axis labels are optional, especially if you'll just be 95 | exporting to another program for use/display. 96 | 97 | If you specify a string (vs \code{FALSE}) to \code{use_glyph} the function 98 | will map the input to a Font Awesome glyph name and use that glyph for the 99 | tile instead of a block (making it more like an isotype pictogram than a 100 | waffle chart). You'll need to install Font Awesome 5 and use 101 | the \code{extrafont} package to 102 | be able to use Font Awesome 5 glyphs. Sizing is also up to the user since 103 | fonts do not automatically scale with graphic resize. 104 | 105 | Glyph idea inspired by Ruben C. Arslan (@_r_c_a) 106 | } 107 | \note{ 108 | You MUST use the Font Awesome 5 fonts bundled with the package. 109 | See \code{\link[=install_fa_fonts]{install_fa_fonts()}}. 110 | } 111 | \examples{ 112 | parts <- c(80, 30, 20, 10) 113 | waffle(parts, rows=8) 114 | 115 | parts <- data.frame( 116 | names = LETTERS[1:4], 117 | vals = c(80, 30, 20, 10) 118 | ) 119 | 120 | waffle(parts, rows=8) 121 | 122 | # library(extrafont) 123 | # waffle(parts, rows=8, use_glyph="shield") 124 | 125 | parts <- c(One=80, Two=30, Three=20, Four=10) 126 | chart <- waffle(parts, rows=8) 127 | # print(chart) 128 | } 129 | -------------------------------------------------------------------------------- /waffle.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | StripTrailingWhitespace: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | PackageBuildArgs: --resave-data 21 | PackageCheckArgs: --as-cran 22 | PackageRoxygenize: rd,collate,namespace 23 | --------------------------------------------------------------------------------