{"id":496,"date":"2018-08-04T20:30:20","date_gmt":"2018-08-04T11:30:20","guid":{"rendered":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-layout-multiple-graphs-in-r\/"},"modified":"2024-10-13T21:08:57","modified_gmt":"2024-10-13T12:08:57","slug":"how-to-layout-multiple-graphs-in-r","status":"publish","type":"post","link":"https:\/\/best-biostatistics.com\/toukei-er\/entry\/how-to-layout-multiple-graphs-in-r\/","title":{"rendered":"R \u3067\u8907\u6570\u306e\u30b0\u30e9\u30d5\u3092\u4e26\u3079\u3066\u66f8\u304f\u65b9\u6cd5"},"content":{"rendered":"\n<p>R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5\u306e\u89e3\u8aac<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\" id=\"R-\u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5-layout\">R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5 layout()<\/h2>\n\n\n\n<p>\u30b0\u30e9\u30d5\u3092\u4e26\u3079\u3066\u63cf\u304d\u305f\u3044\u3068\u601d\u3046\u3053\u3068\u306f\u591a\u3044<\/p>\n\n\n\n<p>R \u306e\u5834\u5408\u3001layout() \u3068\u3044\u3046\u95a2\u6570\u3092\u4f7f\u3046<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"R-\u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5-\u30b0\u30e9\u30d5\u3092\u7e26\u306b2\u3064\u4e26\u3079\u308b-layout12\">R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5 \u30b0\u30e9\u30d5\u3092\u7e26\u306b2\u3064\u4e26\u3079\u308b layout(1:2)<\/h2>\n\n\n\n<p>\u30b0\u30e9\u30d5\u3092\u7e26\u306b 2 \u3064\u4e26\u3079\u308b\u5834\u5408\u306f\u3001layout(1:2) \u3068\u3057\u3066\u304b\u3089\u3001\u30b0\u30e9\u30d5\u3092 2 \u3064\u66f8\u304f\u6307\u4ee4\u3092\u51fa\u3059<\/p>\n\n\n\n<p>tapply() \u3067 2 \u30b0\u30eb\u30fc\u30d7\u306e\u30b0\u30e9\u30d5\u3092\u3044\u3063\u307a\u3093\u306b\u66f8\u3044\u3066\u3082\u3088\u3044<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"synIdentifier\">layout<\/span><span class=\"synSpecial\">(<\/span><span class=\"synConstant\">1<\/span><span class=\"synSpecial\">:<\/span><span class=\"synConstant\">2<\/span><span class=\"synSpecial\">)<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> hist<span class=\"synSpecial\">)<\/span>\n<\/code><\/pre>\n\n\n\n<p>\u305d\u3046\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304b\u308c\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"672\" height=\"672\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211224.png\" alt=\"\" class=\"wp-image-2873\" title=\"\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211224.png 672w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211224-300x300.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211224-150x150.png 150w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<div id=\"biost-2093587181\" class=\"biost- biost-entity-placement\"><p style=\"text-align: center;\"><span style=\"font-size: 20px;\"><strong><a href=\"https:\/\/best-biostatistics.com\/kmhl\">\uff1e\uff1e\u3082\u3046\u7d71\u8a08\u3067\u60a9\u3080\u306e\u306f\u7d42\u308f\u308a\u306b\u3057\u307e\u305b\u3093\u304b\uff1f\u00a0<\/a><\/strong><\/span><\/p>\r\n<a href=\"https:\/\/best-biostatistics.com\/kmhl\"><img class=\"aligncenter wp-image-2794 size-full\" src=\"https:\/\/best-biostatistics.com\/wp\/wp-content\/uploads\/2023\/11\/bn_r_03.png\" alt=\"\" width=\"500\" height=\"327\" \/><\/a>\r\n<p style=\"text-align: center;\"><span style=\"color: #ff0000; font-size: 20px;\"><strong><span class=\"marker2\">\u21911\u4e07\u4eba\u4ee5\u4e0a\u306e\u533b\u7642\u5f93\u4e8b\u8005\u304c\u8cfc\u8aad\u4e2d<\/span><\/strong><\/span><\/p><\/div><h2 class=\"wp-block-heading\">R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5 \u30b0\u30e9\u30d5\u3092\u6a2a\u306b2\u3064\u4e26\u3079\u308b layout(t(1:2))<\/h2>\n\n\n\n<p>\u30b0\u30e9\u30d5\u3092\u6a2a\u306b 2 \u3064\u4e26\u3079\u308b\u5834\u5408\u306f\u3001layout(t(1:2)) \u3068\u3059\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"synIdentifier\">layout<\/span><span class=\"synSpecial\">(<\/span><span class=\"synIdentifier\">t<\/span><span class=\"synSpecial\">(<\/span><span class=\"synConstant\">1<\/span><span class=\"synSpecial\">:<\/span><span class=\"synConstant\">2<\/span><span class=\"synSpecial\">))<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> hist<span class=\"synSpecial\">)<\/span>\n<\/code><\/pre>\n\n\n\n<p>\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6a2a\u306b 2 \u3064\u4e26\u3093\u3060\u30b0\u30e9\u30d5\u304c\u63cf\u3051\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"672\" height=\"672\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211357.png\" alt=\"\" class=\"wp-image-2874\" title=\"\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211357.png 672w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211357-300x300.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211357-150x150.png 150w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<p>\u30b0\u30e9\u30d5\u9818\u57df\u3092\u6a2a\u306b\u5e83\u3052\u308b\uff08\u30c9\u30e9\u30c3\u30b0\u3059\u308b\uff09\u3068\u898b\u6804\u3048\u304c\u826f\u304f\u306a\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"670\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211429-1024x670.png\" alt=\"\" class=\"wp-image-2875\" title=\"\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211429-1024x670.png 1024w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211429-300x196.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211429-768x503.png 768w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211429.png 1027w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"R-\u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5-\u30b0\u30e9\u30d5\u30924\u3064\u4e26\u3079\u308b\u5de6\u4e0a\u5de6\u4e0b\u53f3\u4e0a\u53f3\u4e0b\u306e\u9806\">R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5 \u30b0\u30e9\u30d5\u30924\u3064\u4e26\u3079\u308b\uff08\u5de6\u4e0a\u3001\u5de6\u4e0b\u3001\u53f3\u4e0a\u3001\u53f3\u4e0b\u306e\u9806\uff09<\/h2>\n\n\n\n<p>\u30b0\u30e9\u30d5\u3092 4 \u3064\u4e26\u3079\u305f\u3044\u5834\u5408\u306f\u3001layout(matrix(1:4, nr=2)) \u3092\u4f7f\u3046<\/p>\n\n\n\n<p>nr= \u306f \u884c\u6570\u306e\u6307\u5b9a\u3067\u30012 \u306f 2 \u884c\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b<\/p>\n\n\n\n<p>1 \u304b\u3089 4 \u306e\u6570\u5b57\u3092\u30012 \u884c\u306e\u884c\u5217\u306b\u3059\u308b\u6307\u5b9a\u306a\u306e\u3067\u30012 \u884c 2 \u5217\u306b\u306a\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"synIdentifier\">layout<\/span><span class=\"synSpecial\">(<\/span><span class=\"synType\">matrix<\/span><span class=\"synSpecial\">(<\/span><span class=\"synConstant\">1<\/span><span class=\"synSpecial\">:<\/span><span class=\"synConstant\">4<\/span><span class=\"synSpecial\">,<\/span> nr<span class=\"synStatement\">=<\/span><span class=\"synConstant\">2<\/span><span class=\"synSpecial\">))<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> hist<span class=\"synSpecial\">)<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> qqnorm<span class=\"synSpecial\">)<\/span>\n<\/code><\/pre>\n\n\n\n<p>\u305d\u3046\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b 2 \u884c 2 \u5217\u306e\u30b0\u30e9\u30d5\u63cf\u753b\u9818\u57df\u306b 4 \u3064\u306e\u30b0\u30e9\u30d5\u304c\u63cf\u3051\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"672\" height=\"672\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211629.png\" alt=\"\" class=\"wp-image-2876\" title=\"\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211629.png 672w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211629-300x300.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202211629-150x150.png 150w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"R-\u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5-\u30b0\u30e9\u30d5\u3092\u5225\u306e\u65b9\u6cd5\u30674\u3064\u4e26\u3079\u308b\u5de6\u4e0a\u53f3\u4e0a\u5de6\u4e0b\u53f3\u4e0b\u306e\u9806\">R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5 \u30b0\u30e9\u30d5\u3092\u5225\u306e\u65b9\u6cd5\u30674\u3064\u4e26\u3079\u308b\uff08\u5de6\u4e0a\u3001\u53f3\u4e0a\u3001\u5de6\u4e0b\u3001\u53f3\u4e0b\u306e\u9806\uff09<\/h2>\n\n\n\n<p>4 \u3064\u306e\u30b0\u30e9\u30d5\u3092\u3001\u6a2a\u306b\u76ee\u3092\u52d5\u304b\u3057\u3066\u3001\u5de6\u53f3\u3001\u5de6\u53f3\u3068\u4e26\u3076\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001layout(t(matrix(1:4, nr=2))) \u3068\u3059\u308b<\/p>\n\n\n\n<p>t() \u3068\u3044\u3046\u306e\u306f\u8ee2\u7f6e\u3068\u3044\u3046\u610f\u5473<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"synIdentifier\">layout<\/span><span class=\"synSpecial\">(<\/span><span class=\"synIdentifier\">t<\/span><span class=\"synSpecial\">(<\/span><span class=\"synType\">matrix<\/span><span class=\"synSpecial\">(<\/span><span class=\"synConstant\">1<\/span><span class=\"synSpecial\">:<\/span><span class=\"synConstant\">4<\/span><span class=\"synSpecial\">,<\/span>nr<span class=\"synStatement\">=<\/span><span class=\"synConstant\">2<\/span><span class=\"synSpecial\">)))<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> hist<span class=\"synSpecial\">)<\/span>\n<span class=\"synIdentifier\">tapply<\/span><span class=\"synSpecial\">(<\/span>sleep<span class=\"synSpecial\">$<\/span>extra<span class=\"synSpecial\">,<\/span> sleep<span class=\"synSpecial\">$<\/span>group<span class=\"synSpecial\">,<\/span> qqnorm<span class=\"synSpecial\">)<\/span>\n<\/code><\/pre>\n\n\n\n<p>\u4eca\u5ea6\u306f\u3001\u5de6\u53f3\u3001\u5de6\u53f3\u3068\u63cf\u753b\u3055\u308c\u3066 4 \u3064\u306e\u30b0\u30e9\u30d5\u304c\u4e26\u3093\u3060<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"672\" height=\"672\" src=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202212103.png\" alt=\"\" class=\"wp-image-2878\" title=\"\" srcset=\"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202212103.png 672w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202212103-300x300.png 300w, https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202212103-150x150.png 150w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/figure>\n\n\n\n<p><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u305f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><p>\u7e26\u306b\u4e26\u3079\u308b\u306a\u3089 layout(1:2)<\/p><\/li>\n\n\n\n<li><p>\u6a2a\u306b\u4e26\u3079\u308b\u306a\u3089 layout(t(1:2))<\/p><\/li>\n\n\n\n<li><p>\u7e26\u65b9\u5411\u306e\u9806\u756a\u3067 2&#215;2 \u306a\u3089&nbsp;layout(matrix(1:4, nr=2))<\/p><\/li>\n\n\n\n<li><p>\u6a2a\u65b9\u5411\u306e\u9806\u756a\u3067 2&#215;2 \u306a\u3089&nbsp;layout(t(matrix(1:4, nr=2)))<\/p><\/li>\n<\/ul>\n\n\n\n<p>\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044<\/p>\n","protected":false},"excerpt":{"rendered":"<p>R \u3067\u30b0\u30e9\u30d5\u3092\u8907\u6570\u4e26\u3079\u308b\u65b9\u6cd5\u306e\u89e3\u8aac<\/p>\n","protected":false},"author":2,"featured_media":2878,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,37],"tags":[],"class_list":["post-496","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","category-37"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/best-biostatistics.com\/toukei-er\/wp-content\/uploads\/2018\/08\/20230202212103.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/comments?post=496"}],"version-history":[{"count":2,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":2879,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/posts\/496\/revisions\/2879"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media\/2878"}],"wp:attachment":[{"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/media?parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/categories?post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/best-biostatistics.com\/toukei-er\/wp-json\/wp\/v2\/tags?post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}