Travis-CI Build Status AppVeyor Build Status CRAN_Release_Badge CRAN_Download_Badge

The goal of 


 is to make it ridiculously simple to combine separate ggplots into the same graphic. As such it tries to solve the same problem as 


 but using an API that incites exploration and iteration.


You can install patchwork from github with:


The usage of 


 is simple: just add plots together!

you are of course free to also add the plots together as part of the same plotting operation:

layouts can be specified by adding a 


 call to the assemble. This lets you define the dimensions of the grid and how much space to allocate to the different rows and columns

If you need to add a bit of space between your plots you can use 


 to fill a cell in the grid with nothing

You can make nested plots layout by wrapping part of the plots in parentheses – in these cases the layout is scoped to the different nesting levels

Advanced features

In addition to adding plots and layouts together, 


 defines some other operators that might be of interest. 


 will behave like 


 but put the left and right side in the same nesting level (as opposed to putting the right side into the left sides nesting level). Observe:

this is basically the same as without braces (just like standard math arithmetic) – the plots are added sequentially to the same nesting level. Now look:


p1 + p2



 is on the same level…

There are two additional operators that are used for a slightly different purpose, namely to reduce code repetition. Consider the case where you want to change the theme for all plots in an assemble. Instead of modifying all plots individually you can use 




 to add elements to all subplots. The two differ in that 


 will only affect the plots on the current nesting level:



 will recurse into nested levels:

This is all it does for now, but stay tuned as more functionality is added, such as collapsing guides, etc…


소스: thomasp85/patchwork: The Composer of ggplots