{"id":1920,"date":"2023-07-24T11:04:47","date_gmt":"2023-07-24T11:04:47","guid":{"rendered":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/"},"modified":"2023-07-24T11:04:47","modified_gmt":"2023-07-24T11:04:47","slug":"ukuran-subplot-matplotlib","status":"publish","type":"post","link":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/","title":{"rendered":"Cara menyesuaikan ukuran subplot di matplotlib"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Anda dapat menggunakan sintaks berikut untuk menyesuaikan ukuran subplot di Matplotlib:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#specify one size for all subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 2, figsize=(10,7))\n\n<span style=\"color: #008080;\">#specify individual sizes for subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (1, 2, gridspec_kw={' <span style=\"color: #ff0000;\">width_ratios<\/span> ': [3, 1]})\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Contoh berikut menunjukkan cara menggunakan sintaksis ini dalam praktiknya.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Contoh 1: Tentukan ukuran untuk semua subplot<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Kode berikut menunjukkan cara menentukan ukuran untuk semua subplot:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n\n<span style=\"color: #008080;\">#define subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 2, figsize=(10,7))\nfig. <span style=\"color: #3366ff;\">tight_layout<\/span> ()\n\n<span style=\"color: #008080;\">#define data\n<\/span>x = [1, 2, 3]\ny = [7, 13, 24]\n\n<span style=\"color: #008080;\">#create subplots\n<\/span>ax[0, 0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">red<\/span> ')\nax[0, 1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">blue<\/span> ')\nax[1, 0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">green<\/span> ')\nax[1, 1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">purple<\/span> ')<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-18329 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.png\" alt=\"\" width=\"670\" height=\"466\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Kita dapat dengan mudah mengubah ukuran subjejak dengan mengubah nilai argumen <strong>figsize<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n\n<span style=\"color: #008080;\">#define subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 2, figsize=(5,5))\nfig. <span style=\"color: #3366ff;\">tight_layout<\/span> ()\n\n<span style=\"color: #008080;\">#define data\n<\/span>x = [1, 2, 3]\ny = [7, 13, 24]\n\n<span style=\"color: #008080;\">#create subplots\n<\/span>ax[0, 0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">red<\/span> ')\nax[0, 1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">blue<\/span> ')\nax[1, 0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">green<\/span> ')\nax[1, 1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">purple<\/span> ')<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-18330 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue2.png\" alt=\"\" width=\"306\" height=\"310\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Contoh 2: Tentukan ukuran<\/strong><\/span> <span style=\"color: #000000;\"><strong>masing-masing<\/strong><\/span> <span style=\"color: #000000;\"><strong>subplot<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Kode berikut menunjukkan cara menentukan ukuran berbeda untuk masing-masing subplot:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n\n<span style=\"color: #008080;\">#define subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (1, 2, gridspec_kw={' <span style=\"color: #ff0000;\">width_ratios<\/span> ': [3, 1]})\nfig. <span style=\"color: #3366ff;\">tight_layout<\/span> ()\n\n<span style=\"color: #008080;\">#define data\n<\/span>x = [1, 2, 3]\ny = [7, 13, 24]\n\n<span style=\"color: #008080;\">#create subplots\n<\/span>ax[0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">red<\/span> ')\nax[1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">blue<\/span> ')<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-18333 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue3.png\" alt=\"\" width=\"643\" height=\"387\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Kita dapat dengan mudah mengubah ukuran subjejak dengan mengubah nilai pada argumen <strong>width_ratios<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n\n<span style=\"color: #008080;\">#define subplots\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (1, 2, gridspec_kw={' <span style=\"color: #ff0000;\">width_ratios<\/span> ': [1, 3]})\nfig. <span style=\"color: #3366ff;\">tight_layout<\/span> ()\n\n<span style=\"color: #008080;\">#define data\n<\/span>x = [1, 2, 3]\ny = [7, 13, 24]\n\n<span style=\"color: #008080;\">#create subplots\n<\/span>ax[0]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">red<\/span> ')\nax[1]. <span style=\"color: #3366ff;\">plot<\/span> (x,y,color=' <span style=\"color: #ff0000;\">blue<\/span> ')<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-18334 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue4.png\" alt=\"\" width=\"647\" height=\"380\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Sumber daya tambahan<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/id\/matplotlib-menambahkan-judul\/\" target=\"_blank\" rel=\"noopener\">Bagaimana cara menambahkan judul ke plot di Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/id\/matplotlib-mengatur-rentang-sumbu\/\" target=\"_blank\" rel=\"noopener\">Cara mengatur rentang sumbu di Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/id\/tetapkan-nilai-sumbu-x-matplotlib\/\" target=\"_blank\" rel=\"noopener\">Cara mengatur nilai sumbu X di Matplotlib<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Anda dapat menggunakan sintaks berikut untuk menyesuaikan ukuran subplot di Matplotlib: #specify one size for all subplots fig, ax = plt. subplots (2, 2, figsize=(10,7)) #specify individual sizes for subplots fig, ax = plt. subplots (1, 2, gridspec_kw={&#8216; width_ratios &#8216;: [3, 1]}) Contoh berikut menunjukkan cara menggunakan sintaksis ini dalam praktiknya. Contoh 1: Tentukan ukuran [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/\" \/>\n<meta property=\"og:locale\" content=\"id_ID\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T11:04:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.png\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Ditulis oleh\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimasi waktu membaca\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 menit\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/\",\"url\":\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/\",\"name\":\"Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/id\/#website\"},\"datePublished\":\"2023-07-24T11:04:47+00:00\",\"dateModified\":\"2023-07-24T11:04:47+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81\"},\"description\":\"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/#breadcrumb\"},\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/statorials.org\/id\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cara menyesuaikan ukuran subplot di matplotlib\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/id\/#website\",\"url\":\"https:\/\/statorials.org\/id\/\",\"name\":\"Statorials\",\"description\":\"Panduan anda untuk kompetensi statistik!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/id\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"id\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\/\/statorials.org\/id\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/id\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/id\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Halo, saya Benjamin, pensiunan profesor statistika yang menjadi guru Statorial yang berdedikasi. Dengan pengalaman dan keahlian yang luas di bidang statistika, saya ingin berbagi ilmu untuk memberdayakan mahasiswa melalui Statorials. Baca selengkapnya\",\"sameAs\":[\"http:\/\/statorials.org\/id\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials","description":"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.","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:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/","og_locale":"id_ID","og_type":"article","og_title":"Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials","og_description":"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.","og_url":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/","og_site_name":"Statorials","article_published_time":"2023-07-24T11:04:47+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.png"}],"author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Ditulis oleh":"Benjamin anderson","Estimasi waktu membaca":"2 menit"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/","url":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/","name":"Cara menyesuaikan ukuran subplot di Matplotlib \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/id\/#website"},"datePublished":"2023-07-24T11:04:47+00:00","dateModified":"2023-07-24T11:04:47+00:00","author":{"@id":"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81"},"description":"Tutorial ini menjelaskan cara menyesuaikan ukuran subplot di Matplotlib, dengan beberapa contoh.","breadcrumb":{"@id":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/#breadcrumb"},"inLanguage":"id","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/id\/ukuran-subplot-matplotlib\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/statorials.org\/id\/"},{"@type":"ListItem","position":2,"name":"Cara menyesuaikan ukuran subplot di matplotlib"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/id\/#website","url":"https:\/\/statorials.org\/id\/","name":"Statorials","description":"Panduan anda untuk kompetensi statistik!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/id\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"id"},{"@type":"Person","@id":"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/statorials.org\/id\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/id\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/id\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Halo, saya Benjamin, pensiunan profesor statistika yang menjadi guru Statorial yang berdedikasi. Dengan pengalaman dan keahlian yang luas di bidang statistika, saya ingin berbagi ilmu untuk memberdayakan mahasiswa melalui Statorials. Baca selengkapnya","sameAs":["http:\/\/statorials.org\/id"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/posts\/1920"}],"collection":[{"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/comments?post=1920"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/posts\/1920\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/media?parent=1920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/categories?post=1920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/tags?post=1920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}