{"id":4208,"date":"2023-07-12T20:48:39","date_gmt":"2023-07-12T20:48:39","guid":{"rendered":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/"},"modified":"2023-07-12T20:48:39","modified_gmt":"2023-07-12T20:48:39","slug":"matplotlib-aggiunge-testo-alla-sottotrama","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/","title":{"rendered":"Come aggiungere testo alle sottotrame in matplotlib"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u00c8 possibile utilizzare la seguente sintassi per aggiungere testo a sottotrame specifiche 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;\">Questo particolare esempio aggiunge testo alla prima sottotrama alle coordinate (x,y) <strong>(1,5,20)<\/strong> e testo alla seconda sottotrama alle coordinate (x,y) <strong>(2,10)<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">L&#8217;esempio seguente mostra come utilizzare questa sintassi nella pratica.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio: aggiungi testo alle sottotrame in Matplotlib<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Il codice seguente mostra come creare due sottotrame in Matplotlib, disposte in un layout con due righe e una colonna:<\/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=\"\"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Possiamo utilizzare la seguente sintassi per aggiungere testo in posizioni specifiche su ciascuna sottotrama:<\/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 aggiunge testo alle sottotrame\" width=\"636\" height=\"350\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Nota che il testo \u00e8 stato aggiunto a ciascuna sottotrama alle coordinate (x,y) che abbiamo specificato.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Nota che abbiamo usato <strong>ax[0]<\/strong> per fare riferimento alla prima sottotrama e <strong>ax[1]<\/strong> per fare riferimento alla seconda sottotrama.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Abbiamo quindi utilizzato la funzione <strong>text()<\/strong> per specificare le coordinate (x, y) e il testo specifico da utilizzare in ciascuna sottotrama.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come eseguire altre attivit\u00e0 comuni in Matplotlib:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/titolo-della-sottotrama-matplotlib\/\" target=\"_blank\" rel=\"noopener\">Come aggiungere un titolo alle sottotrame in Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/dimensione-della-sottotrama-matplotlib\/\" target=\"_blank\" rel=\"noopener\">Come regolare la dimensione della sottotrama in Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/spaziatura-della-sottotrama-matplotlib\/\" target=\"_blank\" rel=\"noopener\">Come regolare la spaziatura tra le sottotrame Matplotlib<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c8 possibile utilizzare la seguente sintassi per aggiungere testo a sottotrame specifiche 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, &#8216; Here is some text in the first subplot &#8216;) ax[1]. text (2, 10, [&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>Come aggiungere testo alle sottotrame in Matplotlib - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.\" \/>\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\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come aggiungere testo alle sottotrame in Matplotlib - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/\" \/>\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=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/\",\"url\":\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/\",\"name\":\"Come aggiungere testo alle sottotrame in Matplotlib - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-12T20:48:39+00:00\",\"dateModified\":\"2023-07-12T20:48:39+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come aggiungere testo alle sottotrame in matplotlib\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Come aggiungere testo alle sottotrame in Matplotlib - Statorials","description":"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.","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\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/","og_locale":"it_IT","og_type":"article","og_title":"Come aggiungere testo alle sottotrame in Matplotlib - Statorials","og_description":"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.","og_url":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/","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":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/","url":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/","name":"Come aggiungere testo alle sottotrame in Matplotlib - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-12T20:48:39+00:00","dateModified":"2023-07-12T20:48:39+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come aggiungere testo alle sottotrame in Matplotlib, con un esempio.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/matplotlib-aggiunge-testo-alla-sottotrama\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come aggiungere testo alle sottotrame in matplotlib"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4208"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=4208"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4208\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=4208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=4208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=4208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}