thomasp85/patchwork

Rpatchwork.data-imaginist.com

The Composer of ggplots

rstatsggplot2visualizationggplot-extension
Star 增长趋势
Star
2.6k
Forks
171
周增长
+-2
Issues
75
1k2k
2017年11月2020年10月2023年9月2026年8月
README

patchwork

R-CMD-check CRAN_Release_Badge CRAN_Download_Badge Codecov test
coverage

The goal of patchwork is to make it ridiculously simple to combine separate ggplots into the same graphic. As such it tries to solve the same problem as gridExtra::grid.arrange() and cowplot::plot_grid but using an API that incites exploration and iteration, and scales to arbitrarily complex layouts.

Installation

You can install patchwork from CRAN using install.packages('patchwork'). Alternatively you can grab the development version from github using devtools:

# install.packages("devtools")
devtools::install_github("thomasp85/patchwork")

Basic example

The usage of patchwork is simple: just add plots together!

library(ggplot2)
library(patchwork)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))

p1 + p2

patchwork provides rich support for arbitrarily complex layouts with full alignment. As an example, check out this very readable code for nesting three plots on top of a third:

p3 <- ggplot(mtcars) + geom_smooth(aes(disp, qsec))
p4 <- ggplot(mtcars) + geom_bar(aes(carb))

(p1 | p2 | p3) /
      p4

Learn more

patchwork can do so much more. Check out the guides for learning everything there is to know about all the different features:

Code of Conduct

Please note that the patchwork project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

相关仓库
qinwf/awesome-R

A curated list of awesome R packages, frameworks and software.

Rawesomerdata-science
6.5k1.5k
multiprocessio/datastation

App to easily query, script, and visualize data from every database, file, and API.

TypeScriptnpmOthersqlmysql
datastation.multiprocess.io
3k112
plotly/plotly.R

An interactive graphing library for R

RlibraryOtherrggplot2
plotly-r.com
2.7k641
thomasp85/gganimate

A Grammar of Animated Graphics

RlibraryOtherrstatsggplot2
gganimate.com
2k315
dreamRs/esquisse

RStudio add-in to make plots interactively with ggplot2

RlibraryOtherrggplot2
dreamrs.github.io/esquisse
1.9k243
geocompx/geocompr

Geocomputation with R: an open source book

RtutorialOtherrspatial
r.geocompx.org
1.8k618
EmilHvitfeldt/r-color-palettes

Comprehensive list of color palettes available in R ❤️🧡💛💚💙💜

Rawesomerstatspalette
emilhvitfeldt.github.io/r-color-palettes/
1.7k145
r-spatial/sf

Simple Features for R

RlibraryOtherrspatial
r-spatial.github.io/sf/
1.4k303
hrbrmstr/hrbrthemes

:lock_with_ink_pen: Opinionated, typographic-centric ggplot2 themes and theme components

RlibraryOtherrrstats
1.4k97
ropensci/drake

An R-focused pipeline toolkit for reproducibility and high-performance computing

RGNU General Public License v3.0reproducibilityhigh-performance-computing
docs.ropensci.org/drake
1.3k129
mitchelloharawild/vitae

R Markdown Résumés and CVs

RlibraryGNU General Public License v3.0ozunconf18resume
pkg.mitchelloharawild.com/vitae/
1.3k246
slowkow/ggrepel

:round_pushpin: Repel overlapping text labels away from each other in your ggplot2 figures.

RlibraryGNU General Public License v3.0ggplot2cran
ggrepel.slowkow.com
1.3k94