190 lines
424 KiB
HTML
Raw Normal View History

2025-01-12 00:52:51 +08:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Baptiste Auguie" />
<meta name="date" content="2017-09-09" />
<title>Arranging multiple grobs on a page</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<link href="data:text/css;charset=utf-8,body%20%7B%0Abackground%2Dcolor%3A%20%23fff%3B%0Amargin%3A%201em%20auto%3B%0Amax%2Dwidth%3A%20800px%3B%0Aoverflow%3A%20visible%3B%0Apadding%2Dleft%3A%202em%3B%0Apadding%2Dright%3A%202em%3B%0Afont%2Dfamily%3A%20%22Helvetica%20Neue%22%2C%20Helvetica%2C%20Arial%2C%20sans%2Dserif%3B%0Afont%2Dsize%3A%2014px%3B%0Aline%2Dheight%3A%2020px%3B%0A%7D%0A%23header%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0A%23TOC%20%7B%0Aclear%3A%20both%3B%0Amargin%3A%200%200%2010px%200%3B%0Apadding%3A%204px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Aborder%2Dradius%3A%205px%3B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Afont%2Dsize%3A%2013px%3B%0Aline%2Dheight%3A%201%2E3%3B%0A%7D%0A%23TOC%20%2Etoctitle%20%7B%0Afont%2Dweight%3A%20bold%3B%0Afont%2Dsize%3A%2015px%3B%0Amargin%2Dleft%3A%205px%3B%0A%7D%0A%23TOC%20ul%20%7B%0Apadding%2Dleft%3A%2040px%3B%0Amargin%2Dleft%3A%20%2D1%2E5em%3B%0Amargin%2Dtop%3A%205px%3B%0Amargin%2Dbottom%3A%205px%3B%0A%7D%0A%23TOC%20ul%20ul%20%7B%0Amargin%2Dleft%3A%20%2D2em%3B%0A%7D%0A%23TOC%20li%20%7B%0Aline%2Dheight%3A%2016px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20%7B%0Amargin%3A%20auto%3B%0Amin%2Dwidth%3A%2040%25%3B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dcolor%3A%20%23DDDDDD%3B%0Aborder%2Dstyle%3A%20outset%3B%0Aborder%2Dcollapse%3A%20collapse%3B%0A%7D%0Atable%5Bsummary%3D%22R%20argblock%22%5D%20%7B%0Awidth%3A%20100%25%3B%0Aborder%3A%20none%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20th%20%7B%0Aborder%2Dwidth%3A%202px%3B%0Apadding%3A%205px%3B%0Aborder%2Dstyle%3A%20inset%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20td%20%7B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dstyle%3A%20inset%3B%0Aline%2Dheight%3A%2018px%3B%0Apadding%3A%205px%205px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%2C%20table%3Anot%28%5Bclass%5D%29%20th%2C%20table%3Anot%28%5Bclass%5D%29%20td%20%7B%0Aborder%2Dleft%2Dstyle%3A%20none%3B%0Aborder%2Dright%2Dstyle%3A%20none%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20tr%2Eodd%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%2E5em%200%3B%0A%7D%0Ablockquote%20%7B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Apadding%3A%2013px%3B%0Apadding%2Dbottom%3A%201px%3B%0A%7D%0Ahr%20%7B%0Aborder%2Dstyle%3A%20solid%3B%0Aborder%3A%20none%3B%0Aborder%2Dtop%3A%201px%20solid%20%23777%3B%0Amargin%3A%2028px%200%3B%0A%7D%0Adl%20%7B%0Amargin%2Dleft%3A%200%3B%0A%7D%0Adl%20dd%20%7B%0Amargin%2Dbottom%3A%2013px%3B%0Amargin%2Dleft%3A%2013px%3B%0A%7D%0Adl%20dt%20%7B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Aul%20%7B%0Amargin%2Dtop%3A%200%3B%0A%7D%0Aul%20li%20%7B%0Alist%2Dstyle%3A%20circle%20outside%3B%0A%7D%0Aul%20ul%20%7B%0Amargin%2Dbottom%3A%200%3B%0A%7D%0Apre%2C%20code%20%7B%0Abackground%2Dcolor%3A%20%23f5f5f5%3B%0Aborder%2Dradius%3A%203px%3B%0Acolor%3A%20%23333%3B%0A%7D%0Apre%20%7B%0Aoverflow%2Dx%3A%20auto%3B%0Aborder%2Dradius%3A%203px%3B%0Amargin%3A%205px%200%2010px%200%3B%0Apadding%3A%2010px%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20white%3B%0Aborder%3A%20%23f5f5f5%201px%20solid%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20code%20%7B%0Acolor%3A%20%23444%3B%0Abackground%2Dcolor%3A%20white%3B%0A%7D%0Acode%20%7B%0Afont%2Dfamily%3A%20monospace%3B%0Afont%2Dsize%3A%2090%25%3B%0A%7D%0Ap%20%3E%20code%2C%20li%20%3E%20code%20%7B%0Apadding%3A%202px%204px%3B%0Acolor%3A%20%23d14%3B%0Aborder%3A%201px%20solid%20%23e1e1e8%3B%0Awhite%2Dspace%3A%20inherit%3B%0A%7D%0Adiv%2Efigure%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0Atable%20%3E%20caption%2C%20div%2Efigure%20p%2Ecaption%20%7B%0Afont%2Dstyle%3A%20italic%3B%0A%7D%0Atable%20%3E%20caption%20span%2C%20div%2Efigure%20p%2Ecaption%20span%20%7B%0Afont%2Dstyle%3A%20normal%3B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%200%2010px%3B%0A%7D%0Atable%3Anot%28%5Bclass%5D%29%20%7B%0Amargin%3A%20auto%20auto%2010px%20auto%3B%0A%7D%0Aimg%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20%23FFFFFF%3B%0Apadding%3A%202px%3B%0Aborder%2Dradius%3A%203px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Amargin%3A%200%205px%3B%0Amax%2Dwidth%3A%20100%25%3B%0A%7D%0Ah1%20%7B%0Amargin%2Dtop%3A%200%3B%0Afont%2Dsize%3A%2035px%3B%0Aline%2Dheight%3
</head>
<body>
<h1 class="title toc-ignore">Arranging multiple grobs on a page</h1>
<h4 class="author"><em>Baptiste Auguie</em></h4>
<h4 class="date"><em>2017-09-09</em></h4>
<div id="TOC">
<ul>
<li><a href="#basic-usage">Basic usage</a></li>
<li><a href="#title-andor-annotations">Title and/or annotations</a></li>
<li><a href="#complex-layouts">Complex layouts</a></li>
<li><a href="#nested-layouts-with-arrangegrob">Nested layouts with <code>arrangeGrob</code></a></li>
<li><a href="#multiple-pages-output">Multiple pages output</a></li>
</ul>
</div>
<p>The <code>grid</code> package provides low-level functions to create graphical objects (<code>grobs</code>), and position them on a page in specific <code>viewports</code>. The <code>gtable</code> package introduced a higher-level layout scheme, arguably more amenable to user-level interaction. With the <code>arrangeGrob/grid.arrange()</code> pair of functions, <code>gridExtra</code> builds upon <code>gtable</code> to arrange multiple grobs on a page.</p>
<div id="basic-usage" class="section level2">
<h2>Basic usage</h2>
<p>In this example we mix a few grobs and plots,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(gridExtra)
<span class="kw">library</span>(grid)
<span class="kw">library</span>(ggplot2)
<span class="kw">library</span>(lattice)
p &lt;-<span class="st"> </span><span class="kw">qplot</span>(<span class="dv">1</span>,<span class="dv">1</span>)
p2 &lt;-<span class="st"> </span><span class="kw">xyplot</span>(<span class="dv">1</span><span class="op">~</span><span class="dv">1</span>)
r &lt;-<span class="st"> </span><span class="kw">rectGrob</span>(<span class="dt">gp=</span><span class="kw">gpar</span>(<span class="dt">fill=</span><span class="st">&quot;grey90&quot;</span>))
t &lt;-<span class="st"> </span><span class="kw">textGrob</span>(<span class="st">&quot;text&quot;</span>)
<span class="kw">grid.arrange</span>(t, p, p2, r, <span class="dt">ncol=</span><span class="dv">2</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0XdObS7oGD/MypMXFPXrCwOtoYjyyn7BV29/MZfsVzpLDdRtuIZnbpXzvlf+ev8MvYr/Gqk4H/kV/G3csdazLuyTMPsbFhzd1UabQbjFvDRmcWJxR3zcfHkVw9GfpbJmeev9F08WW8uDkaslwX6avlWGU6N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VIl6kPA9KAwpaZNm7pXLyDQDD+7d+82ddUITeqqoa4KusLfokWL0FW8RwABBNIuwB2AtJNTIQIIIIBAJgusX7/eRo4caSNGjLDvvvuuSFN1Iv/VV1+55a1atXKvGhugmYLUL3r69OlFykyZMsVNI6o8CixICCCAQJACBABB6lM3AggggECgAtOmTTM9QXjJkiUF7dDAX03nqRl3nn/++UJP7tUMPkOHDnUDQDt27OhO+r2Cl156qXv73HPPFRqgqrsFr7zyilvXvXt3LzuvCCCAQGACdAEKjJ6KEUAAAQSCFtBc/qtWrbI+ffpYs2bNXHMqVapkgwcPtv79+9ukSZNs5syZduaZZ7rnAUydOtVWrFjh8uoBYaGpc+fOduSRR5qeCty7d2/r0qWLCx60DY0VUMDQtWvX0CK8RwABBAIRIAAIhJ1KEUAAAQQyWaBdu3b2xBNPuId96YT+1Vdfdc3VFKF6NoCCg/CuPJomU92Ghg0bZu+99569/PLLroyWX3LJJXbttde6MQCZvN+0DQEESodAXv4tTp4qUjqONXuJAAIIIOBDQAN4NbhXD/nS9KAayFtS0lODv/32W9eNSGWKm/qzpG2Frt+7d29g86/zHID9R4LnAJibh5/nAGT3cwC4AxD6PyvvEUAAAQQQCBOoWbOm6SeeVK5cOWvZsmU8RciLAAIIpE2g5MsYaWsKFSGAAAIIIIAAAggggECqBQgAUi3M9hFAAAEEEEAAAQQQyCABAoAMOhg0BQEEEEAAAQQQQACBVAsQAKRamO0jgAACCCCAAAIIIJBBAgQA
</div>
<div id="title-andor-annotations" class="section level2">
<h2>Title and/or annotations</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">gs &lt;-<span class="st"> </span><span class="kw">lapply</span>(<span class="dv">1</span><span class="op">:</span><span class="dv">9</span>, <span class="cf">function</span>(ii)
<span class="kw">grobTree</span>(<span class="kw">rectGrob</span>(<span class="dt">gp=</span><span class="kw">gpar</span>(<span class="dt">fill=</span>ii, <span class="dt">alpha=</span><span class="fl">0.5</span>)), <span class="kw">textGrob</span>(ii)))
<span class="kw">grid.arrange</span>(<span class="dt">grobs=</span>gs, <span class="dt">ncol=</span><span class="dv">4</span>,
<span class="dt">top=</span><span class="st">&quot;top label&quot;</span>, <span class="dt">bottom=</span><span class="st">&quot;bottom</span><span class="ch">\n</span><span class="st">label&quot;</span>,
<span class="dt">left=</span><span class="st">&quot;left label&quot;</span>, <span class="dt">right=</span><span class="st">&quot;right label&quot;</span>)
<span class="kw">grid.rect</span>(<span class="dt">gp=</span><span class="kw">gpar</span>(<span class="dt">fill=</span><span class="ot">NA</span>))</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI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section level2">
<h2>Complex layouts</h2>
<p>We can provide a matrix defining the layout,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">lay &lt;-<span class="st"> </span><span class="kw">rbind</span>(<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">2</span>,<span class="dv">3</span>),
<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">1</span>,<span class="dv">4</span>,<span class="dv">5</span>),
<span class="kw">c</span>(<span class="dv">6</span>,<span class="dv">7</span>,<span class="dv">8</span>,<span class="dv">9</span>,<span class="dv">9</span>))
<span class="kw">grid.arrange</span>(<span class="dt">grobs =</span> gs, <span class="dt">layout_matrix =</span> lay)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv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p8VnbvttrdW7J+yQvuK/zeAhMbPpnYDrZjyRhoCnF8yPo3/x83joox+PXbbcsna8FQKdCaxa
<p>The layout itself may contain holes, but note that for any given grob index the region must be simply connected (no hole),</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">hlay &lt;-<span class="st"> </span><span class="kw">rbind</span>(<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">1</span>,<span class="ot">NA</span>,<span class="dv">2</span>,<span class="dv">3</span>),
<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">1</span>,<span class="ot">NA</span>,<span class="dv">4</span>,<span class="ot">NA</span>),
<span class="kw">c</span>(<span class="ot">NA</span>,<span class="dv">7</span>,<span class="dv">8</span>,<span class="dv">9</span>,<span class="ot">NA</span>))
select_grobs &lt;-<span class="st"> </span><span class="cf">function</span>(lay) {
id &lt;-<span class="st"> </span><span class="kw">unique</span>(<span class="kw">c</span>(<span class="kw">t</span>(lay)))
id[<span class="op">!</span><span class="kw">is.na</span>(id)]
}
<span class="kw">grid.arrange</span>(<span class="dt">grobs=</span>gs[<span class="kw">select_grobs</span>(hlay)], <span class="dt">layout_matrix=</span>hlay)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz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PAICQDy1MlICBAgQIECAAAEChQUEgMKEGiBAgAABAgQIECAQj4AAEE+tjJQAAQIECBAgQIBAYQEBoDChBggQIECAAAECBAjEIyAAxFMrIyVAgAABAgQIECBQWEAAKEyoAQIECBAgQIAAAQLxCAgA8dTKSAkQIECAAAECBAgUFhAAChNqgAABAgQIECBAgEA8AgJAPLUyUgIECBAgQIAAAQKFBQSAwoQaIECAAAECBAgQIBCPgAAQT62MlAABAgQIECBAgEBhAQGgMKEGCBAgQIAAAQIECMQjIADEUysjJUCAAAECBAgQIFBYQAAoTKgBAgQIECBAgAABAvEICADx1MpICRAgQIAAAQIECBQWEAAKE2qAAAECBAgQIECAQDwCAkA8tTJSAgQIECBAgAABAoUFBIDChBogQIAAAQIECBAgEI+AABBPrYyUAAECBAgQIECAQGEBAaAwoQYIECBAgAABAgQIxCMgAMRTKyMlQIAAAQIECBAgUFhAAChMqAECBAgQIECAAAEC8QgIAPHUykgJECBAgAABAgQIFBYQAAoTaoAAAQIECBAgQIBAPAICQDy1MlICBAgQIECAAAEChQUEgMKEGiBAgAABAgQIECAQj4AAEE+tjJQAAQIECBAgQIBAYQEBoDChBggQIECAAAECBAjEIyAAxFMrIyVAgAABAgQIECBQWEAAKEyoAQIECBAgQIAAAQLxCAgA8dTKSAkQIECAAAECBAgUFhAAChNqgAABAgQIECBAgEA8AgJAPLUyUgIECBAgQIAAAQKFBQSAwoQaIECAAAECBAgQIBCPgAAQT62MlAABAgQIECBAgEBhAQGgMKEGCBAgQIAAAQIECMQjIADEUysjJUCAAAECBAgQIFBYQAAoTKgBAgQIECBAgAABAvEICADx1MpICRAgQIAAAQIECBQWEAAKE2qAAAECBAgQIECAQDwCAkA8tTJSAgQIECBAgAABAoUFBIDChBogQIAAAQIECBAgEI+AABBPrYyUAAECBAgQIECAQGEBAaAwoQYIECBAgAABAgQIxCMgAMRTKyMlQIAAAQIECBAgUFhAAChMqAECBAgQIECAAAEC8QgIAPHUykgJECBAgAABAgQIFBYQAAoTaoAAAQIECBAgQIBAPAID4xmqkRIgQIAAAQK9WWDl2rXh67PuCrMXLw6Pr1oZlrz0Ujhkzz3D4XvvE/7y4IPDJ944Kew20FuP3lzDGMb28K3zw/0/nxOWPbEirHr2hTB0zyFhv8P3Dce+9+hw7JlHh/4D/H17R3X0v8IdCdlOgAABAgQI7FDgW/fMCpfNvD282Nzcbt/5y5eH7OfGP80PV95/f/i/U94TJh9ySLt9/EKgOwIvLV8Trvmb68PCexa12/3FpatD9rPgzifCQzc/Es7/zvvCoD0GtdvHL+0F
<p>All cells are of equal size by default, but users may pass explicity <code>widths</code> and/or <code>heights</code> in any valid grid units, or as relative numbers (interpreted as <code>null</code>),</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">grid.arrange</span>(<span class="dt">grobs=</span>gs[<span class="dv">1</span><span class="op">:</span><span class="dv">3</span>], <span class="dt">ncol=</span><span class="dv">2</span>, <span class="dt">widths =</span> <span class="dv">1</span><span class="op">:</span><span class="dv">2</span>,
<span class="dt">heights=</span><span class="kw">unit</span>(<span class="kw">c</span>(<span class="dv">1</span>,<span class="dv">10</span>), <span class="kw">c</span>(<span class="st">&quot;in&quot;</span>, <span class="st">&quot;mm&quot;</span>)))</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAGACAYAAAAargV/AAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZf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EIQUxUIDYUwpQ5KLUqBRmwHNXZ0oIx2piO2te04jqXay/iPtk5HZQxoRNCiyG2goh1pHUvlEhAREpRCEggJSYwkQAK59OyqS9fknPfNu5kxv+f97Exgd9/nt/yez/Nm2O/Z3bNDu0Yu4UKAAAECBAgQIECAQCsExrWiS00SIECAAAECBAgQINAVEACcCAQIECBAgAABAgRaJCAAtGjYWiVAgAABAgQIECAgADgHCBAgQIAAAQIECLRIQABo0bC1SoAAAQIECBAgQEAAcA4QIECAAAECBAgQaJGAANCiYWuVAAECBAgQIECAgADgHCBAgAABAgQIECDQIgEBoEXD1ioBAgQIECBAgAABAcA5QIAAAQIECBAgQKBFAgJAi4atVQIECBAgQIAAAQICgHOAAAECBAgQIECAQIsEBIAWDVurBAgQIECAAAECBAQA5wABAgQIECBAgACBFgkIAC0atlYJECBAgAABAgQICADOAQIECBAgQIAAAQItEhAAWjRsrRIgQIAAAQIECBAQAJwDBAgQIECAAAECBFokIAC0aNhaJUCAAAECBAgQICAAOAcIECBAgAABAgQItEhAAGjRsLVKgAABAgQIECBAQABwDhAgQIAAAQIECBBokYAA0KJha5UAAQIECBAgQICAAOAcIECAAAECBAgQINAiAQGgRcPWKgECBAgQIECAAAEBwDlAgAABAgQIECBAoEUCAkCLhq1VAgQIECBAgAABAgKAc4AAAQIECBAgQIBAiwQEgBYNW6sECBAgQIAAAQIEBADnAAECBAgQIECAAIEWCQgALRq2VgkQIECAAAECBAgIAM4BAgQIECBAgAABAi0SEABaNGytEiBAgAABAgQIEBAAnAMECBAgQIAAAQIEWiQgALRo2FolQIAAAQIECBAgIAA4BwgQIECAAAECBAi0SEAAaNGwtUqAAAECBAgQIEBAAHAOECBAgAABAgQIEGiRgADQomFrlQABAgQIECBAgIAA4BwgQIAAAQIECBAg0CIBAaBFw9YqAQIECBAgQIAAAQHAOUCAAAECBAgQIECgRQICQIuGrVUCBAgQIECAAAECAoBzgAABAgQIECBAgECLBASAFg1bqwQIECBAgAABAgQEAOcAAQIECBAgQIAAgRYJCAAtGrZWCRAgQIAAAQIECAgAzgECBAgQIECAAAECLRIQAFo0bK0SIECAAAECBAgQEACcAwQIECBAgAABAgRaJCAAtGjYWiVAgAABAgQIECAgADgHCBAgQIAAAQIECLRIQABo0bC1SoAAAQIECBAgQEAAcA4QIECAAAECBAgQaJGAANCiYWuVAAECBAgQIECAgADgHCBAgAABAgQIECDQIoHhK664okXtapUAgV8KPPjgg92r8+bN++Vd/k2AAAECBAi0QGD4pptuakGbWiRA4FcFli9fHifHuDjo0f/91UNuEyBAgAABAokFhjdv3hzz589P3KLWCBDYk8ADDzwQE2MoLp776j0ddh8BAgQIECCQUOCKe+6K4U5fM2bMSNielggQqCMw29//OkxqCBAgQIBAGgEfAk4zSo0QIECAAAECBAgQqBYQAKqNVBAgQIAAAQIECBBIIyAApBmlRggQIECAAAECBAhUCwgA1UYqCBAgQIAAAQIECKQREADSjFIjBAgQIECAAAECBKoFBIBqIxUECBAgQIAAAQIE0ggIAGlGqRECBAgQIECAAAEC1QICQLWRCgIECBAgQIAAAQJpBASANKPUCAECBAgQIECAAIFqAQGg2kgFAQIECBAgQIAAgTQCAkCaUWqEAAECBAgQIECAQLWAAFBtpIIAAQIECBAgQIBAGgEBIM0oNUKAAAECBAgQIECgWkAAqDZSQYAAAQIECBAgQCCNgACQZpQaIUCAAAECBAgQIFAtIABUG6kgQIAAAQIECBAgkEZAAEgzSo0QIECAAAECBAgQqBYQAKqNVBAgQIAAAQIECBBIIyAApBmlRggQIECAAAECBAhUCwgA1UYqCBAgQIAAAQIECKQREADSjFIjBAgQIECAAAECBKoFBIBqIxUECBAgQIAAAQIE0ggIAGlGqRECBAgQIECAAAEC1QICQLWRCgIECBAgQIAAAQJpBASANKPUCAECBAgQIECAAIFqAQGg2kgFAQIECBAgQIAAgTQCAkCaUWqEAAECBAgQIECAQLWAAFBtpIIAAQIECBAgQIBAGgEBIM0oNUKAAAECBAgQIECgWkAAqDZSQYAAAQIECBAgQCCNgACQZpQaIUCAAAECBAgQIFAtIABUG6kgQIAAAQIECBAgkEZAAEgzSo0QIECAAAECBAgQqBYQAKqNVBAgQIAAAQIECBBIIyAApBmlRggQIECAAAECBAhUCwgA1UYqCBAgQIAAAQIECKQREADSjFIjBAgQIECAAAECBKoFBIBqIxUECBAgQIAAAQIE0ggIAGlGqRECBAgQIECAAAEC1QICQLWRCgIECBAgQIAAAQJpBASANKPUCAECBAgQIECAAIFqAQGg2kgFAQIECBAgQIAAgTQCAkCaUWqEAAECBAgQIECAQLWAAFBtpIIAAQIECBAgQIBA
</div>
<div id="nested-layouts-with-arrangegrob" class="section level2">
<h2>Nested layouts with <code>arrangeGrob</code></h2>
<p>The <code>grid.arrange()</code> function draws on the device; for more complex layouts, we may want to store the gtable and combine it with other objects, e.g. forming nested layouts. To this end, use <code>arrangeGrob()</code>,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">g1 &lt;-<span class="st"> </span><span class="kw">arrangeGrob</span>(<span class="dt">grobs =</span> gs, <span class="dt">layout_matrix =</span> <span class="kw">t</span>(lay))
g2 &lt;-<span class="st"> </span><span class="kw">arrangeGrob</span>(<span class="dt">grobs =</span> gs, <span class="dt">layout_matrix =</span> lay)
<span class="kw">grid.arrange</span>(g1, g2, <span class="dt">ncol=</span><span class="dv">2</span>)</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZmlsZQAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+f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7Y+lsSd4sCbs+lamrpsjLN78i9/e+31rHDAIIIIAAAk4U4BIgJ2aVmBBAwBTIys+yJNYeXSs3zbrRPPivH95Abmx7k/lTL7y+2Sa74Jw8uHCiPLf8v6z3MIMAAggggIATBSgAnJhVYkIAAVMgK+9CAXBPwt1SWFwofx38Nzn+eLIsuWep+ZP8eIo8N/AF8fcLMN/z4uoXjRuHL1w6BCUCCCCAAAJOE6AAcFpGiQcBBCyB/KJ8a77IOPj/+/UvyjPXPiMB/ucP9tVKNf/8wOfl6V88bbZV7SYvfdR6HzMIIIAAAgg4TYACwGkZJR4EELAEIoIjrPn29TrIH675g/X64pmnBjxtPCb0/OVAa46skaLiooub8BoBBBBAAAFHCFAAOCKNBIEAAuUJRIZEWovjW8aX+ebfWvHTTHhwuLieFJRflCcHMg5c
</div>
<div id="multiple-pages-output" class="section level2">
<h2>Multiple pages output</h2>
<p>Finally, we may want to place grobs on multiple pages; the <code>marrangeGrob()</code> function provides a convenient interface for this, also compatible with <code>ggsave()</code>.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">set.seed</span>(<span class="dv">123</span>)
pl &lt;-<span class="st"> </span><span class="kw">lapply</span>(<span class="dv">1</span><span class="op">:</span><span class="dv">11</span>, <span class="cf">function</span>(.x)
<span class="kw">qplot</span>(<span class="dv">1</span><span class="op">:</span><span class="dv">10</span>, <span class="kw">rnorm</span>(<span class="dv">10</span>), <span class="dt">main=</span><span class="kw">paste</span>(<span class="st">&quot;plot&quot;</span>, .x)))
ml &lt;-<span class="st"> </span><span class="kw">marrangeGrob</span>(pl, <span class="dt">nrow=</span><span class="dv">2</span>, <span class="dt">ncol=</span><span class="dv">2</span>)
## non-interactive use, multipage pdf
## ggsave(&quot;multipage.pdf&quot;, ml)
## interactive use; calling `dev.new` multiple times
ml</code></pre></div>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwAAAAJACAYAAAA6rgFWAAAEDWlDQ1BJQ0MgUHJvZ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Q5jH+an+1y+LlYBifuxAvRN/lVVVOlwlCkdVm9NOL5BE4wkQ2SMlDZU97hX86EilU/lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VVBg/m8AAEAASURBVHgB7J0J/FTT+8efLElK2jdSKYpKCZEkLcpWsu9Lu+wJkRZLIpRK/IjKll8/ISQS0kJEtCihrClapLIm5n8/x/+M+53vvTP3zpyZe+/M53m9vt+5y7lneZ87Z87ynOcpEbNEKCRAAiRAAiRAAiRAAiRAAgVBYKeCKCULSQIkQAIkQAIkQAIkQAIkoAhwAMAXgQRIgARIgARIgARIgAQKiAAHAAVU2SwqCZAACZAACZAACZAACXAAwHeABEiABEiABEiABEiABAqIAAcABVTZLCoJkAAJkAAJkAAJkAAJcADAd4AESIAESIAESIAESIAECogABwAFVNksKgmQAAmQAAmQAAmQAAlwAMB3gARIgARIgARIgARIgAQKiMAuBVRWFpUESIAESCDPCGzdulU+++wz+emnn6Rq1aqy9957S/ny5fOslCwOCZAACZglwBUAszwZGwmQAAnkFYF33nlHdt55Z6lUqVLoyjVkyBCpVq2aHHbYYdKhQwdp0qSJNGjQIK18Tps2Tbp27SoNGzaU3XffXfbZZx/p1KmTPPHEE/LXX3+lFScfIgESIIGwEigRsySsmWO+SIAESIAEgiOwefNmOeKII9QMe8WKFWXjxo3BZSYh5UceeUR69uyZcFWkbdu28sYbbxS77nbhhx9+kLPPPlveeusttyBy8skny5QpU9TAwDUQb5AACZBAhAhwABChymJWSYAESCBXBKBa0759e3n//fdVkmEaAGzfvl322msv+e2331TeOnbsKKeccoogj5UrV5Y2bdp4wvTnn3/KscceK2+//bYKj1n/7t27S7169WTNmjXy9NNP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pJbgwd59tln1SXMCp933nnKIkypUqXk66+/lpdfflnNwMMu/MiRI+WQQw5RYexx4PiGG26QESNGqMtQpenSpYu0bNlSfv/9d7Uy8frrr8uAAQOkevXqiY8WOYf5yRkzZqhrsE1/zjnnqHwjHqiwwHY9ygQLOMjPNddcU+R5PydnnnmmyneiHryfOLyEhSUdcNYCM6PHHHOM1KpVS7EF4++++05Z3GnUqJFYgzp1D+GPP/545egLqwVYoYEcdNBBcvTRR6tjOAEzKWB7wgknCKwFQc4991yT0TMuEiABEgiOQOBDEGaABEiABDIgYF8BsFrSmKVmE7NUb4rEiJn0/v37x2ePrc54kfs4wQy8nrG3nEnFfvzxx2JhLN3zGGbKkQ7+LAs0xcJ89NFHMczw475lqjJmdeCLhZk4cWLMGlTE40FYSw2mSDjLBGX8/sEHHxyzvN0WuY8TS80pZqkmqXCWLnzM6jgXC5PpBZMrAJYfgZjlrVflF6sa1qClWPbAHbP/mrE1uCkW5t13343fv/zyy4vdz+QCmD788MMxy+JPzNocrNKxNgPHLPWjTKLlsyRAAiQQKgISqtwwMyRAAiTgk0DiAAAdOCdB593SL493HGfNmlUkWN++feP3Xn311SL37CdQ+7FmyeMdQ8RrF3RYdec1
</div>
<script type="text/javascript">
window.onload = function() {
var i, fig = 1, caps = document.getElementsByClassName('caption');
for (i = 0; i < caps.length; i++) {
var cap = caps[i];
if (cap.parentElement.className !== 'figure' || cap.nodeName !== 'P')
continue;
cap.innerHTML = '<span>Figure ' + fig + ':</span> ' + cap.innerHTML;
fig++;
}
fig = 1;
caps = document.getElementsByTagName('caption');
for (i = 0; i < caps.length; i++) {
var cap = caps[i];
if (cap.parentElement.nodeName !== 'TABLE') continue;
cap.innerHTML = '<span>Table ' + fig + ':</span> ' + cap.innerHTML;
fig++;
}
}
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>