{"id":8328,"date":"2018-12-31T09:34:29","date_gmt":"2018-12-31T07:34:29","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?post_type=dt_lessons&#038;p=8328"},"modified":"2019-11-18T00:30:44","modified_gmt":"2019-11-17T22:30:44","slug":"combine-multiple-ggplots-into-a-figure","status":"publish","type":"dt_lessons","link":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/","title":{"rendered":"Combine Multiple GGPlots into a Figure"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article describes how to combine <strong>multiple ggplots<\/strong> into a figure. To achieve this task, there are many R function\/packages, including:<\/p>\n<ul>\n<li>grid.arrange() [gridExtra package]<\/li>\n<li>plot_grid() [cowplot package]<\/li>\n<li>plot_layout() [patchwork package]<\/li>\n<li>ggarrange() [ggpubr package]<\/li>\n<\/ul>\n<p>The function <code>ggarrange()<\/code> [ggpubr] is one of the easiest solution for arranging multiple ggplots.<\/p>\n<p>Here, you will learn how to use:<\/p>\n<ul>\n<li>ggplot2 facet functions for creating multiple panel figures that share the same axes<\/li>\n<li>ggarrange() function for combining independent ggplots<\/li>\n<\/ul>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#loading-required-r-packages\">Loading required R packages<\/a><\/li>\n<li><a href=\"#basic-ggplot\">Basic ggplot<\/a><\/li>\n<li><a href=\"#multiple-panels-figure-using-ggplot-facet\">Multiple panels figure using ggplot facet<\/a>\n<ul>\n<li><a href=\"#using-facet_grid\">Using facet_grid<\/a><\/li>\n<li><a href=\"#using-facet_wrap\">Using facet_wrap<\/a><\/li>\n<li><a href=\"#facet-scales\">Facet scales<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#combine-multiple-ggplots-using-ggarrange\">Combine multiple ggplots using ggarrange()<\/a>\n<ul>\n<li><a href=\"#create-some-basic-plots\">Create some basic plots<\/a><\/li>\n<li><a href=\"#combine-the-plots-on-one-page\">Combine the plots on one page<\/a><\/li>\n<li><a href=\"#change-column-and-row-span-of-a-plot\">Change column and row span of a plot<\/a><\/li>\n<li><a href=\"#use-shared-legend-for-combined-ggplots\">Use shared legend for combined ggplots<\/a><\/li>\n<li><a href=\"#combine-the-plots-over-multiple-pages\">Combine the plots over multiple pages<\/a><\/li>\n<li><a href=\"#export-the-arranged-plots\">Export the arranged plots<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div class='dt-sc-ico-content type1'><div class='custom-icon' ><a href='https:\/\/www.datanovia.com\/en\/product\/ggplot2-essentials-for-great-data-visualization-in-r\/' target='_blank'><span class='fa fa-book'><\/span><\/a><\/div><h4><a href='https:\/\/www.datanovia.com\/en\/product\/ggplot2-essentials-for-great-data-visualization-in-r\/' target='_blank'> Related Book <\/a><\/h4>GGPlot2 Essentials for Great Data Visualization in R<\/div>\n<div class='dt-sc-hr-invisible-medium  '><\/div>\n<div id=\"loading-required-r-packages\" class=\"section level2\">\n<h2>Loading required R packages<\/h2>\n<p>Load the ggplot2 package and set the default theme to <code>theme_bw()<\/code> with the legend at the top of the plot:<\/p>\n<pre class=\"r\"><code>library(ggplot2)\r\nlibrary(\"ggpubr\")\r\ntheme_set(\r\n  theme_bw() +\r\n    theme(legend.position = \"top\")\r\n  )<\/code><\/pre>\n<\/div>\n<div id=\"basic-ggplot\" class=\"section level2\">\n<h2>Basic ggplot<\/h2>\n<p>Create a box plot filled by groups:<\/p>\n<pre class=\"r\"><code># Load data and convert dose to a factor variable\r\ndata(\"ToothGrowth\")\r\nToothGrowth$dose &lt;- as.factor(ToothGrowth$dose)\r\n# Box plot\r\np &lt;- ggplot(ToothGrowth, aes(x = dose, y = len)) + \r\n  geom_boxplot(aes(fill = supp), position = position_dodge(0.9)) +\r\n  scale_fill_manual(values = c(\"#00AFBB\", \"#E7B800\"))\r\np<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-basic-boxplot-facets-1.png\" width=\"288\" \/><\/p>\n<\/div>\n<div id=\"multiple-panels-figure-using-ggplot-facet\" class=\"section level2\">\n<h2>Multiple panels figure using ggplot facet<\/h2>\n<p>Facets divide a ggplot into subplots based on the values of one or more categorical variables.<\/p>\n<p>When you are creating multiple plots that share axes, you should consider using facet functions from ggplot2<\/p>\n<p>You write your ggplot2 code as if you were putting all of the data onto one plot, and then you use one of the faceting functions to indicate how to slice up the graph.<\/p>\n<p>There are two main facet functions in the ggplot2 package:<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li><code>facet_grid()<\/code>, which layouts panels in a grid. It creates a matrix of panels defined by row and column faceting variables<\/li>\n<li><code>facet_wrap()<\/code>, which wraps a 1d sequence of panels into 2d. This is generally a better use of screen space than facet_grid() because most displays are roughly rectangular.<\/li>\n<\/ol>\n<div id=\"using-facet_grid\" class=\"section level3\">\n<h3>Using facet_grid<\/h3>\n<ol style=\"list-style-type: decimal;\">\n<li><strong>Facet with one discrete variable<\/strong>. Split by the levels of the group \u201csupp\u201d<\/li>\n<\/ol>\n<pre class=\"r\"><code># Split in vertical direction\r\np + facet_grid(rows = vars(supp))\r\n\r\n# Split in horizontal direction\r\np + facet_grid(cols = vars(supp))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-facet_grid-facet-with-one-variable-1.png\" width=\"316.8\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-facet_grid-facet-with-one-variable-2.png\" width=\"316.8\" \/><\/p>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li><strong>Facet with multiple variables<\/strong>. Split by the levels of two grouping variables: \u201cdose\u201d and \u201csupp\u201d<\/li>\n<\/ol>\n<pre class=\"r\"><code># Facet by two variables: dose and supp.\r\n# Rows are dose and columns are supp\r\np + facet_grid(rows = vars(dose), cols = vars(supp))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-facet_grid-with-two-variable-1.png\" width=\"316.8\" \/><\/p>\n<\/div>\n<div id=\"using-facet_wrap\" class=\"section level3\">\n<h3>Using facet_wrap<\/h3>\n<p><strong>facet_wrap<\/strong>: Facets can be placed side by side using the function <code>facet_wrap()<\/code> as follow :<\/p>\n<pre class=\"r\"><code>p + facet_wrap(vars(dose))\r\n\r\np + facet_wrap(vars(dose), ncol=2)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-facet-wrap-1.png\" width=\"316.8\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-facet-wrap-2.png\" width=\"316.8\" \/><\/p>\n<\/div>\n<div id=\"facet-scales\" class=\"section level3\">\n<h3>Facet scales<\/h3>\n<p>By default, all the panels have the same scales (<code>scales=\"fixed\"<\/code>). They can be made independent, by setting scales to <code>free<\/code>, <code>free_x<\/code>, or <code>free_y<\/code>.<\/p>\n<pre class=\"r\"><code>p + facet_grid(rows = vars(dose), cols = vars(supp), scales = \"free\")<\/code><\/pre>\n<\/div>\n<\/div>\n<div id=\"combine-multiple-ggplots-using-ggarrange\" class=\"section level2\">\n<h2>Combine multiple ggplots using ggarrange()<\/h2>\n<div id=\"create-some-basic-plots\" class=\"section level3\">\n<h3>Create some basic plots<\/h3>\n<pre class=\"r\"><code># 0. Define custom color palette and prepare the data\r\nmy3cols &lt;- c(\"#E7B800\", \"#2E9FDF\", \"#FC4E07\")\r\nToothGrowth$dose &lt;- as.factor(ToothGrowth$dose)\r\n\r\n# 1. Create a box plot (bp)\r\np &lt;- ggplot(ToothGrowth, aes(x = dose, y = len))\r\nbxp &lt;- p + geom_boxplot(aes(color = dose)) +\r\n  scale_color_manual(values = my3cols)\r\n\r\n# 2. Create a dot plot (dp)\r\ndp &lt;- p + geom_dotplot(aes(color = dose, fill = dose), \r\n                       binaxis='y', stackdir='center') +\r\n  scale_color_manual(values = my3cols) + \r\n  scale_fill_manual(values = my3cols)\r\n\r\n# 3. Create a line plot\r\nlp &lt;- ggplot(economics, aes(x = date, y = psavert)) + \r\n  geom_line(color = \"#E46726\") <\/code><\/pre>\n<\/div>\n<div id=\"combine-the-plots-on-one-page\" class=\"section level3\">\n<h3>Combine the plots on one page<\/h3>\n<pre class=\"r\"><code>figure &lt;- ggarrange(bxp, dp, lp,\r\n                    labels = c(\"A\", \"B\", \"C\"),\r\n                    ncol = 2, nrow = 2)\r\nfigure<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-multiple-ggplot-figure-1.png\" width=\"480\" \/><\/p>\n<\/div>\n<div id=\"change-column-and-row-span-of-a-plot\" class=\"section level3\">\n<h3>Change column and row span of a plot<\/h3>\n<p>We\u2019ll use nested <code>ggarrange()<\/code> functions to change column\/row span of plots. For example, using the R code below:<\/p>\n<ul>\n<li>the line plot (lp) will live in the first row and spans over two columns<\/li>\n<li>the box plot (bxp) and the dot plot (dp) will be first arranged and will live in the second row with two different columns<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggarrange(\r\n  lp,                # First row with line plot\r\n  # Second row with box and dot plots\r\n  ggarrange(bxp, dp, ncol = 2, labels = c(\"B\", \"C\")), \r\n  nrow = 2, \r\n  labels = \"A\"       # Label of the line plot\r\n  ) <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-multiple-ggplot-figure-column-row-span-1.png\" width=\"480\" \/><\/p>\n<\/div>\n<div id=\"use-shared-legend-for-combined-ggplots\" class=\"section level3\">\n<h3>Use shared legend for combined ggplots<\/h3>\n<p>To place a common unique legend in the margin of the arranged plots, the function <code>ggarrange()<\/code> [in ggpubr] can be used with the following arguments:<\/p>\n<ul>\n<li><code>common.legend = TRUE<\/code>: place a common legend in a margin<\/li>\n<li><code>legend<\/code>: specify the legend position. Allowed values include one of c(\u201ctop\u201d, \u201cbottom\u201d, \u201cleft\u201d, \u201cright\u201d)<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggarrange(\r\n  bxp, dp, labels = c(\"A\", \"B\"),\r\n  common.legend = TRUE, legend = \"bottom\"\r\n  )<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/016-combine-mutiple-ggplots-shared-legend-for-multiple-ggplots-1.png\" width=\"480\" \/><\/p>\n<\/div>\n<div id=\"combine-the-plots-over-multiple-pages\" class=\"section level3\">\n<h3>Combine the plots over multiple pages<\/h3>\n<p>If you have a long list of ggplots, say n = 20 plots, you may want to arrange the plots and to place them on multiple pages. With 4 plots per page, you need 5 pages to hold the 20 plots.<\/p>\n<p>The function <code>ggarrange()<\/code> [ggpubr] provides a convenient solution to arrange multiple ggplots over multiple pages. After specifying the arguments <code>nrow<\/code> and <code>ncol,<\/code>ggarrange()` computes automatically the number of pages required to hold the list of the plots. It returns a list of arranged ggplots.<\/p>\n<p>For example the following R code,<\/p>\n<pre class=\"r\"><code>multi.page &lt;- ggarrange(bxp, dp, lp, bxp,\r\n                        nrow = 1, ncol = 2)<\/code><\/pre>\n<p>returns a list of two pages with two plots per page. You can visualize each page as follow:<\/p>\n<pre class=\"r\"><code>multi.page[[1]] # Visualize page 1\r\nmulti.page[[2]] # Visualize page 2<\/code><\/pre>\n<p>You can also export the arranged plots to a pdf file using the function <code>ggexport()<\/code> [ggpubr]:<\/p>\n<pre class=\"r\"><code>ggexport(multi.page, filename = \"multi.page.ggplot2.pdf\")<\/code><\/pre>\n<p>See the PDF file: <a href=\"http:\/\/www.slideshare.net\/kassambara\/multipageggplot2\">Multi.page.ggplot2<\/a><\/p>\n<\/div>\n<div id=\"export-the-arranged-plots\" class=\"section level3\">\n<h3>Export the arranged plots<\/h3>\n<p>R function: <code>ggexport()<\/code> [in ggpubr].<\/p>\n<ul>\n<li>Export the arranged figure to a pdf, eps or png file (one figure per page).<\/li>\n<\/ul>\n<pre class=\"r\"><code>ggexport(figure, filename = \"figure1.pdf\")<\/code><\/pre>\n<ul>\n<li>It\u2019s also possible to arrange the plots (2 plot per page) when exporting them.<\/li>\n<\/ul>\n<p>Export individual plots to a pdf file (one plot per page):<\/p>\n<pre class=\"r\"><code>ggexport(bxp, dp, lp, bxp, filename = \"test.pdf\")<\/code><\/pre>\n<p>Arrange and export. Specify the nrow and ncol arguments to display multiple plots on the same page:<\/p>\n<pre class=\"r\"><code>ggexport(bxp, dp, lp, bxp, filename = \"test.pdf\",\r\n         nrow = 2, ncol = 1)<\/code><\/pre>\n<\/div>\n<\/div>\n<div id=\"conclusion\" class=\"section level2\">\n<h2>Conclusion<\/h2>\n<p>This article describes how to create a multiple plots figure using the ggplot2 facet functions and the ggarrange() function available in the ggpubr package. We also show how to export the arranged plots.<\/p>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to combine multiple ggplots into a figure. You will learn how to use: 1) ggplot2 facet functions for creating multiple panel figures that share the same axes; 2) ggarrange() functiong [ggpubr package] for combining independent ggplots.<\/p>\n","protected":false},"author":1,"featured_media":7728,"parent":0,"menu_order":26,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-8328","dt_lessons","type-dt_lessons","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Combine Multiple GGPlots into a Figure - Datanovia<\/title>\n<meta name=\"description\" content=\"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Combine Multiple GGPlots into a Figure - Datanovia\" \/>\n<meta property=\"og:description\" content=\"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-17T22:30:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/\",\"name\":\"How to Combine Multiple GGPlots into a Figure - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg\",\"datePublished\":\"2018-12-31T07:34:29+00:00\",\"dateModified\":\"2019-11-17T22:30:44+00:00\",\"description\":\"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lessons\",\"item\":\"https:\/\/www.datanovia.com\/en\/lessons\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Combine Multiple GGPlots into a Figure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Combine Multiple GGPlots into a Figure - Datanovia","description":"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/","og_locale":"en_US","og_type":"article","og_title":"How to Combine Multiple GGPlots into a Figure - Datanovia","og_description":"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.","og_url":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/","og_site_name":"Datanovia","article_modified_time":"2019-11-17T22:30:44+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/","url":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/","name":"How to Combine Multiple GGPlots into a Figure - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg","datePublished":"2018-12-31T07:34:29+00:00","dateModified":"2019-11-17T22:30:44+00:00","description":"This article describes how to combine multiple ggplots into a figure. You will learn how to use ggplot2 facet functions and ggpubr pacage for combining independent ggplots.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0484.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/lessons\/combine-multiple-ggplots-into-a-figure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"Lessons","item":"https:\/\/www.datanovia.com\/en\/lessons\/"},{"@type":"ListItem","position":3,"name":"Combine Multiple GGPlots into a Figure"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/8328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/dt_lessons"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=8328"}],"version-history":[{"count":0,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/8328\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/7728"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=8328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}