Code Monkey home page Code Monkey logo

gganonymize's Introduction

gganonymize

Travis build status

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.

Installation

You can install the development version from Github using devtools:

# install.packages("devtools")
devtools::install_github("EmilHvitfeldt/gganonymize")

Examples

gganonymize will replace the text in the title, subtitle, caption and tag with similar length text while ignoring numerics.

library(ggplot2)
library(gganonymize)

ggg <- ggplot(mtcars, aes(as.factor(cyl))) +
  geom_bar() +
  labs(title = "Test title",
       subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest",
       caption = "Test caption",
       tag = 1) +
  facet_wrap(~vs)

gganonomize(ggg)

It will respect names of of columns used in multiple settings such that the legend will match.

ggg <- ggplot(mtcars, aes(mpg, disp, color = disp, shape = factor(am))) +
  geom_point()

gganonomize(ggg)

Likewise will it sepect names in character/factor variables.

ggg <- ggplot(mpg, aes(class, fill = class)) +
  geom_bar() + 
  labs(title = "Super sensitive title",
       subtitle = "This part is even more sensitive, I hope no one will get to read it")

gganonomize(ggg)

and in facet labels.

ggg <- ggplot(mpg, aes(cty, displ, color = class)) +
  geom_point() +
  facet_wrap(~ class)

gganonomize(ggg)

This also extends to geom_label,

ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) +
  geom_label()

gganonomize(ggg)

and geom_text.

ggg <- ggplot(iris, aes(Sepal.Length, Sepal.Width, label = Species)) +
  geom_text()

gganonomize(ggg)

Now with as much mtcars as possible

ggg <- ggplot(mtcars, aes(as.factor(cyl))) +
  geom_bar() +
  labs(title = "Test title",
       subtitle = "Test subtitle, this one have a lot lot lot lot lot more text then the rest",
       caption = "Test caption",
       tag = 1) +
  facet_wrap(~vs)

mtcarsize(ggg)

gganonymize's People

Contributors

emilhvitfeldt avatar

Stargazers

 avatar Botan Ağın avatar Ryan Yeung avatar Balthasar  avatar dikip avatar Jay Jeffries avatar Sebastian Lammers avatar John MacKintosh avatar wang minjie avatar Ladislas Nalborczyk avatar Tanner Stauss avatar  avatar  avatar Toni Rodon avatar Robin Browne avatar geom_赵小赫 avatar Michael DeWitt avatar Leo Lee avatar Xiangyun Huang avatar João avatar Mikhail Popov avatar Maëlle Salmon avatar Bryce Frank avatar Jason J. Benedict avatar Roberto Salas avatar Luiz Fernando  avatar  avatar Christophe Dervieux avatar Michał Bojanowski avatar  avatar timelyportfolio avatar Dominik Kusy avatar Ryo Nakagawara avatar Michael E.  avatar Anastasia Lucas avatar Sean Nguyen avatar Sean Fischer avatar Simon Grundt Straubinger avatar TJ Mahr avatar Sandy Kawano avatar Nicholas Tierney avatar Andrew Heiss avatar ChanYub Park avatar Michael W. Kearney avatar

Watchers

timelyportfolio avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.