Git Product home page Git Product logo

ggpipe's Introduction

ggpipe

ggplot with the pipe

This package wraps most ggplot2 functions so they work with the pipe %>% with minimal overhead (if noticeable).

Travis-CI Build Status CRAN_Status_Badge

Installation

You can install ggpipe from github with:

# install.packages("devtools")
devtools::install_github("zeehio/ggpipe")

Example

# as ggpipe wraps ggplot2 functions, do not use library(ggplot2) in your scripts
library(ggpipe)
ggplot(mtcars) %>% 
  geom_point(aes(x = mpg, y = disp)) 

This package provides an additional unggplot() function to get back the data from the plot, so multiple plots could be generated on a single pipe:

iris_sepal_png <- "README-iris_sepal.png"
iris_petal_png <- "README-iris_petal.png"

iris %>%
  ggplot() %>%
  geom_point(aes(x = Sepal.Length, y = Sepal.Width, color = Species)) %>%
  ggsave(iris_sepal_png, height = 3, width = 5, dpi = 72) %>%
  unggplot() %>%
  ggplot() %>%
  geom_point(aes(x = Petal.Length, y = Petal.Width, color = Species)) %>%
  ggsave(iris_petal_png, height = 3, width = 5, dpi = 72) %>%
  unggplot() %>%
  head()
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1          5.1         3.5          1.4         0.2  setosa
#> 2          4.9         3.0          1.4         0.2  setosa
#> 3          4.7         3.2          1.3         0.2  setosa
#> 4          4.6         3.1          1.5         0.2  setosa
#> 5          5.0         3.6          1.4         0.2  setosa
#> 6          5.4         3.9          1.7         0.4  setosa

Plot the two figures:

knitr::include_graphics(iris_sepal_png)

knitr::include_graphics(iris_petal_png)

ggpipe's People

Contributors

zeehio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

xtmgah phgis

ggpipe's Issues

Review test-stat* and test-theme

  • I added all the ggplot tests from 2.2.1
  • I reviewed the tests, removing those testing ggplot internals
  • I simplified the tests, testing only for equality between ggplot objects generated by ggpipe and ggplot (the plot building phase is not touched by ggpipe)

The last step (simplify the tests) was not done for the test-stat* and test-theme* tests, so I leave that for the future, before a CRAN release.

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.