{"id":4208,"date":"2023-07-12T20:48:39","date_gmt":"2023-07-12T20:48:39","guid":{"rendered":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/"},"modified":"2023-07-12T20:48:39","modified_gmt":"2023-07-12T20:48:39","slug":"matplotlib-tekst-toevoegen-aan-subplot","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/","title":{"rendered":"Tekst toevoegen aan subplots in matplotlib"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de volgende syntaxis gebruiken om tekst toe te voegen aan specifieke subplots in Matplotlib:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #000000;\"><span style=\"color: #008000;\">import<\/span> matplotlib. <span style=\"color: #008000;\"><span style=\"color: #3366ff;\">pyplot<\/span> as<\/span> plt\n\n<span style=\"color: #008080;\">#define subplot layout<\/span>\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 1, figsize=(7,4))\n\n<span style=\"color: #008080;\">#add text at specific locations in subplots\n<\/span>ax[0]. <span style=\"color: #3366ff;\">text<\/span> (1.5, 20, ' <span style=\"color: #ff0000;\">Here is some text in the first subplot<\/span> ')\nax[1]. <span style=\"color: #3366ff;\">text<\/span> (2, 10, ' <span style=\"color: #ff0000;\">Here is some text in the second subplot<\/span> ')\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dit specifieke voorbeeld voegt tekst toe aan de eerste subplot op (x,y) co\u00f6rdinaten <strong>(1,5,20)<\/strong> en tekst aan de tweede subplot op (x,y) co\u00f6rdinaten <strong>(2,10)<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Het volgende voorbeeld laat zien hoe u deze syntaxis in de praktijk kunt gebruiken.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld: tekst toevoegen aan subplots in Matplotlib<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u twee subplots maakt in Matplotlib, gerangschikt in een lay-out met twee rijen en \u00e9\u00e9n kolom:<\/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 subplot layout\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 1, figsize=(7,4))\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-33278 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.jpg\" alt=\"\" width=\"582\" height=\"333\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">We kunnen de volgende syntaxis gebruiken om tekst toe te voegen op specifieke locaties in elk subplot:<\/span><\/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 subplot layout\n<\/span>fig, ax = plt. <span style=\"color: #3366ff;\">subplots<\/span> (2, 1, figsize=(7,4))\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> ')\n\n<span style=\"color: #008080;\">#add text at specific locations in subplots\n<\/span>ax[0]. <span style=\"color: #3366ff;\">text<\/span> (1.5, 20, ' <span style=\"color: #ff0000;\">Here is some text in the first subplot<\/span> ')\nax[1]. <span style=\"color: #3366ff;\">text<\/span> (2, 10, ' <span style=\"color: #ff0000;\">Here is some text in the second subplot<\/span> ')\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-33279\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue2.jpg\" alt=\"Matplotlib voegt tekst toe aan subplots\" width=\"636\" height=\"350\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat er tekst is toegevoegd aan elke subplot op de (x,y) co\u00f6rdinaten die we hebben opgegeven.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat we <strong>ax[0]<\/strong> hebben gebruikt om naar het eerste subplot te verwijzen en <strong>ax[1]<\/strong> om naar het tweede subplot te verwijzen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Vervolgens hebben we de functie <strong>text()<\/strong> gebruikt om de (x, y)-co\u00f6rdinaten te specificeren, evenals de specifieke tekst die in elke subplot moet worden gebruikt.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende taken in Matplotlib kunt uitvoeren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/matplotlib-subplottitel\/\" target=\"_blank\" rel=\"noopener\">Hoe u een titel aan subplots in Matplotlib toevoegt<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/matplotlib-subplotgrootte\/\" target=\"_blank\" rel=\"noopener\">Hoe de subplotgrootte in Matplotlib aan te passen<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/subplot-afstand-matplotlib\/\" target=\"_blank\" rel=\"noopener\">Hoe u de afstand tussen Matplotlib-subplots kunt aanpassen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de volgende syntaxis gebruiken om tekst toe te voegen aan specifieke subplots in Matplotlib: import matplotlib. pyplot as plt #define subplot layout fig, ax = plt. subplots (2, 1, figsize=(7,4)) #add text at specific locations in subplots ax[0]. text (1.5, 20, &#8218; Here is some text in the first subplot &#8218;) ax[1]. text [&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-4208","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>Tekst toevoegen aan subplots in Matplotlib - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.\" \/>\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-tekst-toevoegen-aan-subplot\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tekst toevoegen aan subplots in Matplotlib - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-12T20:48:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.jpg\" \/>\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-tekst-toevoegen-aan-subplot\/\",\"url\":\"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/\",\"name\":\"Tekst toevoegen aan subplots in Matplotlib - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-12T20:48:39+00:00\",\"dateModified\":\"2023-07-12T20:48:39+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tekst toevoegen aan subplots in matplotlib\"}]},{\"@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":"Tekst toevoegen aan subplots in Matplotlib - Statorials","description":"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.","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-tekst-toevoegen-aan-subplot\/","og_locale":"de_DE","og_type":"article","og_title":"Tekst toevoegen aan subplots in Matplotlib - Statorials","og_description":"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.","og_url":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/","og_site_name":"Statorials","article_published_time":"2023-07-12T20:48:39+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-intrigue1.jpg"}],"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-tekst-toevoegen-aan-subplot\/","url":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/","name":"Tekst toevoegen aan subplots in Matplotlib - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-12T20:48:39+00:00","dateModified":"2023-07-12T20:48:39+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt met een voorbeeld uitgelegd hoe u tekst aan subplots in Matplotlib kunt toevoegen.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/matplotlib-tekst-toevoegen-aan-subplot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Tekst toevoegen aan subplots in matplotlib"}]},{"@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\/4208","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=4208"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4208\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}