{"id":1599,"date":"2023-07-25T17:15:30","date_gmt":"2023-07-25T17:15:30","guid":{"rendered":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/"},"modified":"2023-07-25T17:15:30","modified_gmt":"2023-07-25T17:15:30","slug":"plot-python-distribusi-normal","status":"publish","type":"post","link":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/","title":{"rendered":"Cara merencanakan distribusi normal dengan python: dengan contoh"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Untuk memplot distribusi normal dengan Python, Anda dapat menggunakan sintaks berikut:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#x-axis ranges from -3 and 3 with .001 steps\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (-3, 3, 0.001)\n\n<span style=\"color: #008080;\">#plot normal distribution with mean 0 and standard deviation 1\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1))\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Array <strong>x<\/strong> mendefinisikan rentang sumbu x dan <strong>plt.plot()<\/strong> menghasilkan kurva distribusi normal dengan mean dan deviasi standar yang ditentukan.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Contoh berikut menunjukkan cara menggunakan fungsi-fungsi ini dalam praktik.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Contoh 1: Merencanakan Distribusi Normal Tunggal<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Kode berikut menunjukkan cara memplot kurva distribusi normal tunggal dengan rata-rata 0 dan deviasi standar 1:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n<span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n<span style=\"color: #008000;\">from<\/span> scipy. <span style=\"color: #3366ff;\">stats<\/span> <span style=\"color: #008000;\">import<\/span> norm\n\n<span style=\"color: #008080;\">#x-axis ranges from -3 and 3 with .001 steps\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (-3, 3, 0.001)\n\n<span style=\"color: #008080;\">#plot normal distribution with mean 0 and standard deviation 1\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1))<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-15893\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython1.png\" alt=\"Distribusi Normal dengan Python\" width=\"388\" height=\"259\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Anda juga dapat mengubah warna dan lebar garis pada grafik:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1), color=' <span style=\"color: #ff0000;\">red<\/span> ', linewidth= <span style=\"color: #008000;\">3<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-15894 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython2.png\" alt=\"\" width=\"403\" height=\"264\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Contoh 2: Merencanakan Distribusi Normal Berganda<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Kode berikut menunjukkan cara memplot beberapa kurva distribusi normal dengan rata-rata dan deviasi standar yang berbeda:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n<span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n<span style=\"color: #008000;\">from<\/span> scipy. <span style=\"color: #3366ff;\">stats<\/span> <span style=\"color: #008000;\">import<\/span> norm\n\n<span style=\"color: #008080;\">#x-axis ranges from -5 and 5 with .001 steps\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (-5, 5, 0.001)\n\n<span style=\"color: #008080;\">#define multiple normal distributions\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1), label=' <span style=\"color: #ff0000;\">\u03bc: 0, \u03c3: 1<\/span> ')\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1.5), label=' <span style=\"color: #ff0000;\">\u03bc:0, \u03c3: 1.5<\/span> ')\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 2), label=' <span style=\"color: #ff0000;\">\u03bc:0, \u03c3: 2<\/span> ')\n\n<span style=\"color: #008080;\">#add legend to plot\n<\/span>plt. <span style=\"color: #3366ff;\">legend<\/span> ()<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-15895 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython3.png\" alt=\"\" width=\"388\" height=\"259\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Jangan ragu untuk mengubah warna garis dan menambahkan judul dan label sumbu untuk melengkapi bagan:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n<span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt\n<span style=\"color: #008000;\">from<\/span> scipy. <span style=\"color: #3366ff;\">stats<\/span> <span style=\"color: #008000;\">import<\/span> norm\n\n<span style=\"color: #008080;\">#x-axis ranges from -5 and 5 with .001 steps\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (-5, 5, 0.001)\n\n<span style=\"color: #008080;\">#define multiple normal distributions\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1), label=' <span style=\"color: #ff0000;\">\u03bc: 0, \u03c3: 1<\/span> ', color=' <span style=\"color: #ff0000;\">gold<\/span> ')\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 1.5), label=' <span style=\"color: #ff0000;\">\u03bc:0, \u03c3: 1.5<\/span> ', color=' <span style=\"color: #ff0000;\">red<\/span> ')\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, norm. <span style=\"color: #3366ff;\">pdf<\/span> (x, 0, 2), label=' <span style=\"color: #ff0000;\">\u03bc:0, \u03c3: 2<\/span> ', color=' <span style=\"color: #ff0000;\">pink<\/span> ')\n\n<span style=\"color: #008080;\">#add legend to plot\n<\/span>plt. <span style=\"color: #3366ff;\">legend<\/span> (title=' <span style=\"color: #ff0000;\">Parameters<\/span> ')\n\n<span style=\"color: #008080;\">#add axes labels and a title\n<\/span>plt. <span style=\"color: #3366ff;\">ylabel<\/span> (' <span style=\"color: #ff0000;\">Density<\/span> ')\nplt. <span style=\"color: #3366ff;\">xlabel<\/span> (' <span style=\"color: #ff0000;\">x<\/span> ')\nplt. <span style=\"color: #3366ff;\">title<\/span> (' <span style=\"color: #ff0000;\">Normal Distributions<\/span> ', fontsize= <span style=\"color: #008000;\">14<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-15896 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython4.png\" alt=\"\" width=\"416\" height=\"291\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Lihat <a href=\"https:\/\/matplotlib.org\/stable\/api\/_as_gen\/matplotlib.pyplot.plot.html\" target=\"_blank\" rel=\"noopener\">dokumentasi matplotlib<\/a> untuk penjelasan detail tentang fungsi <strong>plt.plot()<\/strong> .<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Untuk memplot distribusi normal dengan Python, Anda dapat menggunakan sintaks berikut: #x-axis ranges from -3 and 3 with .001 steps x = np. arange (-3, 3, 0.001) #plot normal distribution with mean 0 and standard deviation 1 plt. plot (x, norm. pdf (x, 0, 1)) Array x mendefinisikan rentang sumbu x dan plt.plot() menghasilkan kurva [&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 Merencanakan Distribusi Normal dengan Python: Dengan Contoh<\/title>\n<meta name=\"description\" content=\"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, 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\/plot-python-distribusi-normal\/\" \/>\n<meta property=\"og:locale\" content=\"id_ID\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cara Merencanakan Distribusi Normal dengan Python: Dengan Contoh\" \/>\n<meta property=\"og:description\" content=\"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, dengan beberapa contoh.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-25T17:15:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython1.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\/plot-python-distribusi-normal\/\",\"url\":\"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/\",\"name\":\"Cara Merencanakan Distribusi Normal dengan Python: Dengan Contoh\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/id\/#website\"},\"datePublished\":\"2023-07-25T17:15:30+00:00\",\"dateModified\":\"2023-07-25T17:15:30+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81\"},\"description\":\"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, dengan beberapa contoh.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/#breadcrumb\"},\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/statorials.org\/id\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cara merencanakan distribusi normal dengan python: dengan contoh\"}]},{\"@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 Merencanakan Distribusi Normal dengan Python: Dengan Contoh","description":"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, 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\/plot-python-distribusi-normal\/","og_locale":"id_ID","og_type":"article","og_title":"Cara Merencanakan Distribusi Normal dengan Python: Dengan Contoh","og_description":"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, dengan beberapa contoh.","og_url":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/","og_site_name":"Statorials","article_published_time":"2023-07-25T17:15:30+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/normaldistpython1.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\/plot-python-distribusi-normal\/","url":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/","name":"Cara Merencanakan Distribusi Normal dengan Python: Dengan Contoh","isPartOf":{"@id":"https:\/\/statorials.org\/id\/#website"},"datePublished":"2023-07-25T17:15:30+00:00","dateModified":"2023-07-25T17:15:30+00:00","author":{"@id":"https:\/\/statorials.org\/id\/#\/schema\/person\/3d17a1160dd2d052b7c78e502cb9ec81"},"description":"Tutorial ini menjelaskan cara memplot distribusi normal dengan Python, dengan beberapa contoh.","breadcrumb":{"@id":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/#breadcrumb"},"inLanguage":"id","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/id\/plot-python-distribusi-normal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/statorials.org\/id\/"},{"@type":"ListItem","position":2,"name":"Cara merencanakan distribusi normal dengan python: dengan contoh"}]},{"@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\/1599"}],"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=1599"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/posts\/1599\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/media?parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/categories?post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/id\/wp-json\/wp\/v2\/tags?post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}