{"id":1188,"date":"2023-07-27T08:47:37","date_gmt":"2023-07-27T08:47:37","guid":{"rendered":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/"},"modified":"2023-07-27T08:47:37","modified_gmt":"2023-07-27T08:47:37","slug":"matplotlib-vulling-tussen","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/","title":{"rendered":"Hoe gebieden tussen lijnen in matplotlib te vullen"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt het gebied tussen waarden in een Matplotlib-plot eenvoudig vullen met behulp van de volgende functies:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><a href=\"https:\/\/matplotlib.org\/3.3.2\/api\/_as_gen\/matplotlib.pyplot.fill_between.html\" target=\"_blank\" rel=\"noopener noreferrer\">fill_between()<\/a> : Vult het gebied tussen twee horizontale curven.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><a href=\"https:\/\/matplotlib.org\/3.3.2\/api\/_as_gen\/matplotlib.pyplot.fill_betweenx.html#matplotlib.pyplot.fill_betweenx\" target=\"_blank\" rel=\"noopener noreferrer\">fill_betweenx()<\/a> : Vult het gebied tussen twee verticale curven.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Deze tutorial biedt voorbeelden van hoe u elk van deze functies in de praktijk kunt gebruiken.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 1: Vul het gebied tussen twee horizontale lijnen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u het gebied tussen twee horizontale lijnen vult:<\/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<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (0,10,0.1)\ny = np. <span style=\"color: #3366ff;\">arange<\/span> (10,20,0.1)\n\n<span style=\"color: #008080;\">#create plot of values\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y)\n\n<span style=\"color: #008080;\">#fill in area between the two lines\n<\/span>plt. <span style=\"color: #3366ff;\">fill_between<\/span> (x,y,color=' <span style=\"color: #008000;\">red<\/span> ')\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11808 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre1.png\" alt=\"Vul het gebied tussen de regels in Matplotlib\" width=\"428\" height=\"286\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat we ook de functie <strong>plt.grid()<\/strong> kunnen gebruiken om een raster aan de plot toe te voegen om gemakkelijker te zien welke waarden gevuld zijn:<\/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<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (0,10,0.1)\ny = np. <span style=\"color: #3366ff;\">arange<\/span> (10,20,0.1)\n\n<span style=\"color: #008080;\">#create plot of values\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y)\n\n<span style=\"color: #008080;\">#fill in area between the two lines\n<\/span>plt. <span style=\"color: #3366ff;\">fill_between<\/span> (x, y, color=' <span style=\"color: #008000;\">red<\/span> ', alpha= <span style=\"color: #008000;\">.5<\/span> )\n\n<span style=\"color: #008080;\">#add gridlines<\/span>\nplt. <span style=\"color: #3366ff;\">grid<\/span> ()<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11809 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre2.png\" alt=\"Vul het gebied tussen de regels matplotlib\" width=\"420\" height=\"276\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 2: Vul het gebied onder een curve<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u het gebied onder een curve vult:<\/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<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (0,10,0.1)\ny = x**4\n\n<span style=\"color: #008080;\">#create plot of values\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y)\n\n<span style=\"color: #008080;\">#fill in area between the two lines\n<\/span>plt. <span style=\"color: #3366ff;\">fill_between<\/span> (x, y, color=' <span style=\"color: #008000;\">red<\/span> ', alpha= <span style=\"color: #008000;\">.5<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11810 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre3.png\" alt=\"Vul tussen Matplotlib\" width=\"446\" height=\"287\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 3: Vul het gebied boven een curve<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u het gebied boven een curve vult:<\/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<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (0,10,0.1)\ny = x**4\n\n<span style=\"color: #008080;\">#create plot of values\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y)\n\n<span style=\"color: #008080;\">#fill in area between the two lines\n<\/span>plt. <span style=\"color: #3366ff;\">fill_between<\/span> (x, y, np. <span style=\"color: #3366ff;\">max<\/span> (y), color=' <span style=\"color: #008000;\">red<\/span> ', alpha= <span style=\"color: #008000;\">.5<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11811 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre4.png\" alt=\"Vul het gebied boven de curve in Matplotlib\" width=\"440\" height=\"284\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld 4: Vul het gebied tussen twee verticale lijnen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de functie <strong>fill_betweenx()<\/strong> gebruikt om het gebied tussen twee verticale lijnen te vullen:<\/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<span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span>x = np. <span style=\"color: #3366ff;\">arange<\/span> (0,10,0.1)\ny = np. <span style=\"color: #3366ff;\">arange<\/span> (10,20,0.1)\n\n<span style=\"color: #008080;\">#create plot of values\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y)\n\n<span style=\"color: #008080;\">#fill in area between the two lines\n<\/span>plt. <span style=\"color: #3366ff;\">fill_betweenx<\/span> (y, 2, 4, color=' <span style=\"color: #008000;\">red<\/span> ', alpha= <span style=\"color: #008000;\">.5<\/span> )<\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11812 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre5.png\" alt=\"Vul tussen twee regels in matplotlib in python\" width=\"494\" height=\"317\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><strong>Gerelateerd:<\/strong><\/span> <a href=\"https:\/\/statorials.org\/nl\/vloeiende-curve-matplotlib\/\" target=\"_blank\" rel=\"noopener noreferrer\">Hoe een vloeiende curve in Matplotlib te plotten<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt het gebied tussen waarden in een Matplotlib-plot eenvoudig vullen met behulp van de volgende functies: fill_between() : Vult het gebied tussen twee horizontale curven. fill_betweenx() : Vult het gebied tussen twee verticale curven. Deze tutorial biedt voorbeelden van hoe u elk van deze functies in de praktijk kunt gebruiken. Voorbeeld 1: Vul het [&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":[],"class_list":["post-1188","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe gebieden tussen lijnen in Matplotlib te vullen<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.\" \/>\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\/nl\/matplotlib-vulling-tussen\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe gebieden tussen lijnen in Matplotlib te vullen\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T08:47:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre1.png\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/\",\"url\":\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/\",\"name\":\"Hoe gebieden tussen lijnen in Matplotlib te vullen\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-27T08:47:37+00:00\",\"dateModified\":\"2023-07-27T08:47:37+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe gebieden tussen lijnen in matplotlib te vullen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe gebieden tussen lijnen in Matplotlib te vullen","description":"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.","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\/nl\/matplotlib-vulling-tussen\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe gebieden tussen lijnen in Matplotlib te vullen","og_description":"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/","og_site_name":"Statorials","article_published_time":"2023-07-27T08:47:37+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/remplirentre1.png"}],"author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/","url":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/","name":"Hoe gebieden tussen lijnen in Matplotlib te vullen","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-27T08:47:37+00:00","dateModified":"2023-07-27T08:47:37+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe je de gebieden tussen twee regels in Matplotlib vult, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/matplotlib-vulling-tussen\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe gebieden tussen lijnen in matplotlib te vullen"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/1188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=1188"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/1188\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=1188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=1188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=1188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}