├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── R ├── aaa.R ├── anonomize.R ├── gganonomize.R ├── mtcarsize.R └── sysdata.rda ├── README.Rmd ├── README.md ├── data-raw └── animals.R ├── gganonymize.Rproj └── man ├── figures ├── README-unnamed-chunk-1-1.png ├── README-unnamed-chunk-2-1.png ├── README-unnamed-chunk-3-1.png ├── README-unnamed-chunk-4-1.png ├── README-unnamed-chunk-5-1.png ├── README-unnamed-chunk-6-1.png └── README-unnamed-chunk-7-1.png ├── gganonomize.Rd └── mtcarsize.Rd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^\.travis\.yml$ 2 | ^README\.Rmd$ 3 | ^LICENSE\.md$ 4 | ^data-raw$ 5 | ^gganonymize\.Rproj$ 6 | ^\.Rproj\.user$ 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | language: R 4 | sudo: false 5 | cache: packages 6 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: gganonymize 2 | Title: The goal of gganonymize is to anonymize the labels and text in a 3 | 'ggplot2' object in such a way that vizualizations about sensitive 4 | information can more easily be shared and critiqued 5 | Version: 0.0.0.9000 6 | Authors@R: 7 | person(given = "Emil", 8 | family = "Hvitfeldt", 9 | role = c("aut", "cre"), 10 | email = "emilhhvitfeldt@gmail.com") 11 | Description: What the package does (one paragraph). 12 | License: MIT + file LICENSE 13 | Encoding: UTF-8 14 | LazyData: true 15 | Depends: 16 | R (>= 2.10) 17 | Imports: 18 | ggplot2, 19 | tibble, 20 | rlang 21 | RoxygenNote: 6.1.1 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Emil Hvitfeldt 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Emil Hvitfeldt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(gganonomize) 4 | export(mtcarsize) 5 | importFrom(rlang,"%||%") 6 | importFrom(stats,runif) 7 | -------------------------------------------------------------------------------- /R/aaa.R: -------------------------------------------------------------------------------- 1 | single_word <- function(x) !grepl(" ", x) 2 | 3 | #' @importFrom stats runif 4 | lorem <- function(n, words = NULL) { 5 | rwords <- function(n) { 6 | words <- words %||% c("SED", "IN", "UT", "ET", "AC", "EU", "NON", 7 | "NEC", "AMET", "SIT", "VEL", "AT", "MAURIS", "A", 8 | "VITAE", "EGET", "QUIS", "NUNC", "NULLA", "ID", "VESTIBULUM", 9 | "PELLENTESQUE", "TINCIDUNT", "ALIQUAM", "IPSUM", 10 | "DONEC", "TURPIS", "LIGULA", "EGESTAS", "NIBH", "SAPIEN", 11 | "ANTE", "NISL", "VELIT", "ERAT", "EROS", "LEO", "MAGNA", 12 | "JUSTO", "ENIM", "MI", "PURUS", "EST", "LACUS", "LOREM", 13 | "QUAM", "DIAM", "RISUS", "DOLOR", "SEM", "AUGUE", 14 | "NEQUE", "TEMPOR", "DUI", "ARCU", "METUS", "TORTOR", 15 | "URNA", "LIBERO", "PHARETRA", "TEMPUS", "FAUCIBUS", 16 | "LECTUS", "SUSPENDISSE", "FELIS", "ODIO", "ORCI", 17 | "VARIUS", "MASSA", "TELLUS", "VOLUTPAT", "BLANDIT", 18 | "INTERDUM", "LOBORTIS", "MAXIMUS", "NISI", "LUCTUS", 19 | "PORTTITOR", "AUCTOR", "ELEMENTUM", "EX", "MAECENAS", 20 | "MALESUADA", "TRISTIQUE", "ULLAMCORPER", "ULTRICES", 21 | "NULLAM", "CONSEQUAT", "LACINIA", "PHASELLUS", "ACCUMSAN", 22 | "DAPIBUS", "ELEIFEND", "COMMODO", "DUIS", "EFFICITUR", 23 | "ELIT", "IMPERDIET", "AENEAN", "IACULIS", "NAM", 24 | "CONSECTETUR", "FERMENTUM", "PORTA", "SCELERISQUE", 25 | "SODALES", "FEUGIAT", "LAOREET", "VULPUTATE", "DICTUM", 26 | "QUISQUE", "FACILISIS", "FINIBUS", "ORNARE", "PULVINAR", 27 | "RHONCUS", "CONDIMENTUM", "MOLLIS", "PRETIUM", "ALIQUET", 28 | "CONGUE", "POSUERE", "SUSCIPIT", "ULTRICIES", "CURABITUR", 29 | "GRAVIDA", "MATTIS", "VIVERRA", "CURSUS", "EUISMOD", 30 | "RUTRUM", "VENENATIS", "CONVALLIS", "PROIN", "VEHICULA", 31 | "PLACERAT", "SAGITTIS", "CRAS", "INTEGER", "MORBI", 32 | "VIVAMUS", "PRAESENT", "BIBENDUM", "MOLESTIE", "SEMPER", 33 | "FRINGILLA", "FUSCE", "DIGNISSIM", "ETIAM", "HENDRERIT", 34 | "SOLLICITUDIN", "PER", "FAMES", "POTENTI", "AD", 35 | "APTENT", "CLASS", "CONUBIA", "HIMENAEOS", "INCEPTOS", 36 | "LITORA", "NOSTRA", "SOCIOSQU", "TACITI", "TORQUENT", 37 | "HABITANT", "NETUS", "SENECTUS", "PRIMIS", "CUM", 38 | "DIS", "MAGNIS", "MONTES", "MUS", "NASCETUR", "NATOQUE", 39 | "PARTURIENT", "PENATIBUS", "RIDICULUS", "SOCIIS", 40 | "ADIPISCING", "FACILISI", "CUBILIA", "CURAE", "DICTUMST", 41 | "HABITASSE", "HAC", "PLATEA") 42 | dzipf <- function(k, N, s) 1/k^s/sum(1/(1:N)^s) 43 | pzipf.y <- c(0, cumsum(dzipf(1:length(words), length(words), 44 | 0.5))) 45 | robs <- findInterval(runif(n), pzipf.y) 46 | words[robs] 47 | } 48 | out <- rwords(floor(n / 2)) 49 | out <- tolower(out) 50 | paste0(out[seq_len(min(which(cumsum(nchar(out) + 1) > n)))], collapse = " ") 51 | } 52 | -------------------------------------------------------------------------------- /R/anonomize.R: -------------------------------------------------------------------------------- 1 | anonomize_labels <- function(x) { 2 | if (is.numeric(x)) { 3 | return(x) 4 | } 5 | 6 | if (single_word(x)) { 7 | return(sample(animals, 1)) 8 | } 9 | lorem(nchar(x)) 10 | } 11 | 12 | anonomize_char <- function(x) { 13 | if (any(is.character(x))) { 14 | out <- as.factor(x) 15 | levels(out) <- sample(animals, length(levels(out))) 16 | return(out) 17 | } 18 | if (any(is.factor(x))) { 19 | out <- x 20 | levels(out) <- sample(animals, length(levels(out))) 21 | return(out) 22 | } 23 | x 24 | } 25 | -------------------------------------------------------------------------------- /R/gganonomize.R: -------------------------------------------------------------------------------- 1 | #' Anonomize labels and text in a ggplot2 object 2 | #' 3 | #' @param x a ggplot object 4 | #' 5 | #' @return a ggplot object 6 | #' @export 7 | #' 8 | #' @examples 9 | #' library(ggplot2) 10 | #' fff <- ggplot(mtcars, aes(mpg, disp, color = factor(vs), shape = factor(am))) + 11 | #' geom_point() 12 | #' 13 | #' fff 14 | #' 15 | #' gganonomize(fff) 16 | gganonomize <- function(x) { 17 | name_table <- table(unlist(x$labels)) 18 | repeat_name <- names(which(name_table > 1)) 19 | ignore_labels <- x$labels %in% repeat_name 20 | if (any(name_table > 1)) { 21 | 22 | for (name in repeat_name) { 23 | x$labels[names(x$labels[x$labels == name])] <- sample(animals, 1) 24 | } 25 | } 26 | 27 | x$labels[!ignore_labels] <- lapply(x$labels[!ignore_labels], anonomize_labels) 28 | x$data <- data.frame(lapply(x$data, anonomize_char), stringsAsFactors = FALSE) 29 | 30 | x 31 | } 32 | -------------------------------------------------------------------------------- /R/mtcarsize.R: -------------------------------------------------------------------------------- 1 | #' Anonomize labels and text in a ggplot2 object to make it look like mtcars 2 | #' 3 | #' @param x a ggplot object 4 | #' 5 | #' @return a ggplot object 6 | #' @export 7 | #' 8 | #' @importFrom rlang "%||%" 9 | #' @examples 10 | #' library(ggplot2) 11 | #' fff <- ggplot(mtcars, aes(mpg, disp, color = factor(vs), shape = factor(am))) + 12 | #' geom_point() 13 | #' 14 | #' fff 15 | #' 16 | #' mtcarsize(fff) 17 | mtcarsize <- function(x) { 18 | name_table <- table(unlist(x$labels)) 19 | repeat_name <- names(which(name_table > 1)) 20 | ignore_labels <- x$labels %in% repeat_name 21 | if (any(name_table > 1)) { 22 | 23 | for (name in repeat_name) { 24 | x$labels[names(x$labels[x$labels == name])] <- sample(names(datasets::mtcars), 1) 25 | } 26 | } 27 | 28 | x$labels[!ignore_labels] <- lapply(x$labels[!ignore_labels], mtcars_labels) 29 | x$data <- data.frame(lapply(x$data, mtcars_char), stringsAsFactors = FALSE) 30 | 31 | x 32 | } 33 | 34 | mtcars_labels <- function(x) { 35 | if (is.numeric(x)) { 36 | return(x) 37 | } 38 | 39 | if (single_word(x)) { 40 | return(sample(names(datasets::mtcars), 1)) 41 | } 42 | lorem(nchar(x), unlist(strsplit(rownames(datasets::mtcars), " "))) 43 | } 44 | 45 | mtcars_char <- function(x) { 46 | if (any(is.character(x))) { 47 | out <- as.factor(x) 48 | levels(out) <- sample(rownames(datasets::mtcars), length(levels(out))) 49 | return(out) 50 | } 51 | if (any(is.factor(x))) { 52 | out <- x 53 | levels(out) <- sample(rownames(datasets::mtcars), length(levels(out))) 54 | return(out) 55 | } 56 | x 57 | } 58 | 59 | -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/R/sysdata.rda -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r setup, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | # gganonymize 16 | 17 | [![Travis build status](https://travis-ci.org/EmilHvitfeldt/gganonymize.svg?branch=master)](https://travis-ci.org/EmilHvitfeldt/gganonymize) 18 | 19 | The goal of gganonymize is to anonymize the labels and text in a ggplot2 object in such a way that vizualizations about sensitive information can more easily be shared and critiqued. 20 | 21 | ## Installation 22 | 23 | You can install the development version from Github using `devtools`: 24 | 25 | ``` r 26 | # install.packages("devtools") 27 | devtools::install_github("EmilHvitfeldt/gganonymize") 28 | ``` 29 | 30 | ## Examples 31 | 32 | `gganonymize` will replace the text in the title, subtitle, caption and tag with similar length text while ignoring numerics. 33 | 34 | ```{r} 35 | library(ggplot2) 36 | library(gganonymize) 37 | 38 | ggg <- ggplot(mtcars, aes(as.factor(cyl))) + 39 | geom_bar() + 40 | labs(title = "Test title", 41 | subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest", 42 | caption = "Test caption", 43 | tag = 1) + 44 | facet_wrap(~vs) 45 | 46 | gganonomize(ggg) 47 | ``` 48 | 49 | It will respect names of of columns used in multiple settings such that the legend will match. 50 | 51 | ```{r} 52 | ggg <- ggplot(mtcars, aes(mpg, disp, color = disp, shape = factor(am))) + 53 | geom_point() 54 | 55 | gganonomize(ggg) 56 | ``` 57 | 58 | Likewise will it sepect names in character/factor variables. 59 | 60 | 61 | ```{r} 62 | ggg <- ggplot(mpg, aes(class, fill = class)) + 63 | geom_bar() + 64 | labs(title = "Super sensitive title", 65 | subtitle = "This part is even more sensitive, I hope no one will get to read it") 66 | 67 | gganonomize(ggg) 68 | ``` 69 | 70 | and in facet labels. 71 | 72 | ```{r} 73 | ggg <- ggplot(mpg, aes(cty, displ, color = class)) + 74 | geom_point() + 75 | facet_wrap(~ class) 76 | 77 | gganonomize(ggg) 78 | ``` 79 | 80 | This also extends to geom_label, 81 | 82 | ```{r} 83 | ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) + 84 | geom_label() 85 | 86 | gganonomize(ggg) 87 | ``` 88 | 89 | and geom_text. 90 | 91 | ```{r} 92 | ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) + 93 | geom_text() 94 | 95 | gganonomize(ggg) 96 | ``` 97 | 98 | ## Now with as much mtcars as possible 99 | 100 | ```{r} 101 | ggg <- ggplot(mtcars, aes(as.factor(cyl))) + 102 | geom_bar() + 103 | labs(title = "Test title", 104 | subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest", 105 | caption = "Test caption", 106 | tag = 1) + 107 | facet_wrap(~vs) 108 | 109 | mtcarsize(ggg) 110 | ``` 111 | 112 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # gganonymize 5 | 6 | [![Travis build 7 | status](https://travis-ci.org/EmilHvitfeldt/gganonymize.svg?branch=master)](https://travis-ci.org/EmilHvitfeldt/gganonymize) 8 | 9 | The goal of gganonymize is to anonymize the labels and text in a ggplot2 10 | object in such a way that vizualizations about sensitive information can 11 | more easily be shared and critiqued. 12 | 13 | ## Installation 14 | 15 | You can install the development version from Github using `devtools`: 16 | 17 | ``` r 18 | # install.packages("devtools") 19 | devtools::install_github("EmilHvitfeldt/gganonymize") 20 | ``` 21 | 22 | ## Examples 23 | 24 | `gganonymize` will replace the text in the title, subtitle, caption and 25 | tag with similar length text while ignoring numerics. 26 | 27 | ``` r 28 | library(ggplot2) 29 | library(gganonymize) 30 | 31 | ggg <- ggplot(mtcars, aes(as.factor(cyl))) + 32 | geom_bar() + 33 | labs(title = "Test title", 34 | subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest", 35 | caption = "Test caption", 36 | tag = 1) + 37 | facet_wrap(~vs) 38 | 39 | gganonomize(ggg) 40 | ``` 41 | 42 | 43 | 44 | It will respect names of of columns used in multiple settings such that 45 | the legend will 46 | match. 47 | 48 | ``` r 49 | ggg <- ggplot(mtcars, aes(mpg, disp, color = disp, shape = factor(am))) + 50 | geom_point() 51 | 52 | gganonomize(ggg) 53 | ``` 54 | 55 | 56 | 57 | Likewise will it sepect names in character/factor variables. 58 | 59 | ``` r 60 | ggg <- ggplot(mpg, aes(class, fill = class)) + 61 | geom_bar() + 62 | labs(title = "Super sensitive title", 63 | subtitle = "This part is even more sensitive, I hope no one will get to read it") 64 | 65 | gganonomize(ggg) 66 | ``` 67 | 68 | 69 | 70 | and in facet labels. 71 | 72 | ``` r 73 | ggg <- ggplot(mpg, aes(cty, displ, color = class)) + 74 | geom_point() + 75 | facet_wrap(~ class) 76 | 77 | gganonomize(ggg) 78 | ``` 79 | 80 | 81 | 82 | This also extends to geom\_label, 83 | 84 | ``` r 85 | ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) + 86 | geom_label() 87 | 88 | gganonomize(ggg) 89 | ``` 90 | 91 | 92 | 93 | and geom\_text. 94 | 95 | ``` r 96 | ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) + 97 | geom_text() 98 | 99 | gganonomize(ggg) 100 | ``` 101 | 102 | 103 | 104 | ## Now with as much mtcars as possible 105 | 106 | ``` r 107 | ggg <- ggplot(mtcars, aes(as.factor(cyl))) + 108 | geom_bar() + 109 | labs(title = "Test title", 110 | subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest", 111 | caption = "Test caption", 112 | tag = 1) + 113 | facet_wrap(~vs) 114 | 115 | mtcarsize(ggg) 116 | ``` 117 | 118 | 119 | -------------------------------------------------------------------------------- /data-raw/animals.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | library(rvest) 3 | 4 | main_page <- read_html("https://a-z-animals.com/animals/") 5 | 6 | animals <- html_nodes(main_page, 'div[class="content"] li') %>% 7 | html_text() 8 | 9 | animals <- unique(animals[!grepl(" ", animals)]) 10 | use_data(animals, internal = TRUE) 11 | -------------------------------------------------------------------------------- /gganonymize.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 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 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /man/figures/README-unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmilHvitfeldt/gganonymize/7cf575eb8878e41964646f338f3eb7eb142476fa/man/figures/README-unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /man/gganonomize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gganonomize.R 3 | \name{gganonomize} 4 | \alias{gganonomize} 5 | \title{Anonomize labels and text in a ggplot2 object} 6 | \usage{ 7 | gganonomize(x) 8 | } 9 | \arguments{ 10 | \item{x}{a ggplot object} 11 | } 12 | \value{ 13 | a ggplot object 14 | } 15 | \description{ 16 | Anonomize labels and text in a ggplot2 object 17 | } 18 | \examples{ 19 | library(ggplot2) 20 | fff <- ggplot(mtcars, aes(mpg, disp, color = factor(vs), shape = factor(am))) + 21 | geom_point() 22 | 23 | fff 24 | 25 | gganonomize(fff) 26 | } 27 | -------------------------------------------------------------------------------- /man/mtcarsize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mtcarsize.R 3 | \name{mtcarsize} 4 | \alias{mtcarsize} 5 | \title{Anonomize labels and text in a ggplot2 object to make it look like mtcars} 6 | \usage{ 7 | mtcarsize(x) 8 | } 9 | \arguments{ 10 | \item{x}{a ggplot object} 11 | } 12 | \value{ 13 | a ggplot object 14 | } 15 | \description{ 16 | Anonomize labels and text in a ggplot2 object to make it look like mtcars 17 | } 18 | \examples{ 19 | library(ggplot2) 20 | fff <- ggplot(mtcars, aes(mpg, disp, color = factor(vs), shape = factor(am))) + 21 | geom_point() 22 | 23 | fff 24 | 25 | mtcarsize(fff) 26 | } 27 | --------------------------------------------------------------------------------