{"id":1190,"date":"2023-07-27T08:34:43","date_gmt":"2023-07-27T08:34:43","guid":{"rendered":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/"},"modified":"2023-07-27T08:34:43","modified_gmt":"2023-07-27T08:34:43","slug":"espessura-da-linha-matplotlib","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/","title":{"rendered":"Como ajustar a espessura da linha no matplotlib"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Voc\u00ea pode ajustar facilmente a espessura das linhas em gr\u00e1ficos Matplotlib usando a fun\u00e7\u00e3o de argumento <b>linewidth<\/b> , que usa a seguinte sintaxe:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>matplotlib.pyplot.plot(x, y, largura de linha=1,5)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Por padr\u00e3o, a largura da linha \u00e9 1,5, mas voc\u00ea pode ajust\u00e1-la para qualquer valor maior que 0.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Este tutorial fornece v\u00e1rios exemplos de uso pr\u00e1tico desta fun\u00e7\u00e3o.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 1: Ajustar a espessura de uma linha<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como criar um gr\u00e1fico de linhas simples e definir a largura da linha como 3:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import <span style=\"color: #000000;\">matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> <span style=\"color: #008000;\">as<\/span> plt<\/span>\nimport <span style=\"color: #000000;\">numpy<\/span> as <span style=\"color: #000000;\">np<\/span>\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span><span style=\"color: #000000;\">x = np. <span style=\"color: #3366ff;\">linspace<\/span> (0, 10, 100)\ny1 = np. <span style=\"color: #3366ff;\">sin<\/span> (x)*np. <span style=\"color: #3366ff;\">exp<\/span> (-x\/3)\n\n<span style=\"color: #008080;\">#create line plot with line width set to 3\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, y1, linewidth= <span style=\"color: #008000;\">3<\/span> )\n\n<span style=\"color: #008080;\">#displayplot\n<\/span>plt. <span style=\"color: #3366ff;\">show<\/span> ()\n<\/span><\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11835 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/largeur-de-ligne1-1.png\" alt=\"Ajustar a largura da linha no matplotlib\" width=\"418\" height=\"277\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 2:<\/strong><\/span> <span style=\"color: #000000;\"><strong>Ajustar a espessura de m\u00faltiplas linhas<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como ajustar a espessura de v\u00e1rias linhas de uma s\u00f3 vez:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import <span style=\"color: #000000;\">matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> as plt<\/span>\nimport <span style=\"color: #000000;\">numpy<\/span> as <span style=\"color: #000000;\">np<\/span>\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span><span style=\"color: #000000;\">x = np. <span style=\"color: #3366ff;\">linspace<\/span> (0, 10, 100)\ny1 = np. <span style=\"color: #3366ff;\">sin<\/span> (x)*np. <span style=\"color: #3366ff;\">exp<\/span> (-x\/3)\ny2 = np. <span style=\"color: #3366ff;\">cos<\/span> (x)*np. <span style=\"color: #3366ff;\">exp<\/span> (-x\/5)\n\n<span style=\"color: #008080;\">#create line plot with multiple lines\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x, y1, linewidth= <span style=\"color: #008000;\">3<\/span> )\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, y2, linewidth= <span style=\"color: #008000;\">1<\/span> )\n\n<span style=\"color: #008080;\">#displayplot\n<\/span>plt. <span style=\"color: #3366ff;\">show<\/span> ()<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11836 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/largeur-de-ligne2.png\" alt=\"Ajuste v\u00e1rios pesos de linha no matplotlib em Python\" width=\"425\" height=\"273\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 3: ajuste a espessura das linhas nas legendas<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como criar v\u00e1rias linhas com espessuras diferentes e criar uma legenda que exibe a espessura de cada linha de acordo:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import <span style=\"color: #000000;\">matplotlib. <span style=\"color: #3366ff;\">pyplot<\/span> as plt<\/span>\nimport <span style=\"color: #000000;\">numpy<\/span> as <span style=\"color: #000000;\">np<\/span>\n\n<span style=\"color: #008080;\">#define x and y values\n<\/span><span style=\"color: #000000;\">x = np. <span style=\"color: #3366ff;\">linspace<\/span> (0, 10, 100)\ny1 = np. <span style=\"color: #3366ff;\">sin<\/span> (x)*np. <span style=\"color: #3366ff;\">exp<\/span> (-x\/3)\ny2 = np. <span style=\"color: #3366ff;\">cos<\/span> (x)*np. <span style=\"color: #3366ff;\">exp<\/span> (-x\/5)\n\n<span style=\"color: #008080;\">#create line plot with multiple lines\n<\/span>plt. <span style=\"color: #3366ff;\">plot<\/span> (x,y1,linewidth=3,label=' <span style=\"color: #008000;\">y1<\/span> ')\nplt. <span style=\"color: #3366ff;\">plot<\/span> (x, y2, linewidth=1, label=' <span style=\"color: #008000;\">y2<\/span> ')\n\n<span style=\"color: #008080;\">#add legend\n<\/span>plt. <span style=\"color: #3366ff;\">legend<\/span> ()\n\n<span style=\"color: #008080;\">#displayplot\n<\/span>plt. <span style=\"color: #3366ff;\">show<\/span> ()<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11837 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/largeur-de-ligne3.png\" alt=\"Ajustar a largura da linha na legenda matplotlib\" width=\"385\" height=\"254\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/pt\/preenchimento-matplotlib-entre\/\" target=\"_blank\" rel=\"noopener noreferrer\">Como preencher \u00e1reas entre linhas no Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/matplotlib-remove-carrapatos\/\" target=\"_blank\" rel=\"noopener noreferrer\">Como remover carrapatos de gr\u00e1ficos Matplotlib<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/legenda-matplotlib-fora-do-grafico\/\" target=\"_blank\" rel=\"noopener noreferrer\">Como colocar a legenda fora de um gr\u00e1fico Matplotlib<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Voc\u00ea pode ajustar facilmente a espessura das linhas em gr\u00e1ficos Matplotlib usando a fun\u00e7\u00e3o de argumento linewidth , que usa a seguinte sintaxe: matplotlib.pyplot.plot(x, y, largura de linha=1,5) Por padr\u00e3o, a largura da linha \u00e9 1,5, mas voc\u00ea pode ajust\u00e1-la para qualquer valor maior que 0. Este tutorial fornece v\u00e1rios exemplos de uso pr\u00e1tico desta [&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-1190","post","type-post","status-publish","format-standard","hentry","category-guia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Como ajustar a espessura da linha no Matplotlib - Statorials<\/title>\n<meta name=\"description\" content=\"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.\" \/>\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\/pt\/espessura-da-linha-matplotlib\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como ajustar a espessura da linha no Matplotlib - Statorials\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T08:34:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/largeur-de-ligne1-1.png\" \/>\n<meta name=\"author\" content=\"Dr. benjamim anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. benjamim anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/\",\"url\":\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/\",\"name\":\"Como ajustar a espessura da linha no Matplotlib - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-27T08:34:43+00:00\",\"dateModified\":\"2023-07-27T08:34:43+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como ajustar a espessura da linha no matplotlib\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/pt\/#website\",\"url\":\"https:\/\/statorials.org\/pt\/\",\"name\":\"Statorials\",\"description\":\"O seu guia para a literacia estat\u00edstica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/pt\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\",\"name\":\"Dr. benjamim anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. benjamim anderson\"},\"description\":\"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais\",\"sameAs\":[\"https:\/\/statorials.org\/pt\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como ajustar a espessura da linha no Matplotlib - Statorials","description":"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.","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\/pt\/espessura-da-linha-matplotlib\/","og_locale":"pt_PT","og_type":"article","og_title":"Como ajustar a espessura da linha no Matplotlib - Statorials","og_description":"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.","og_url":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/","og_site_name":"Statorials","article_published_time":"2023-07-27T08:34:43+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/largeur-de-ligne1-1.png"}],"author":"Dr. benjamim anderson","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Dr. benjamim anderson","Tempo estimado de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/","url":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/","name":"Como ajustar a espessura da linha no Matplotlib - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-27T08:34:43+00:00","dateModified":"2023-07-27T08:34:43+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica como ajustar a espessura da linha em gr\u00e1ficos Matplotlib, com v\u00e1rios exemplos.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/espessura-da-linha-matplotlib\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"Como ajustar a espessura da linha no matplotlib"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/pt\/#website","url":"https:\/\/statorials.org\/pt\/","name":"Statorials","description":"O seu guia para a literacia estat\u00edstica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/pt\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-PT"},{"@type":"Person","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666","name":"Dr. benjamim anderson","image":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr. benjamim anderson"},"description":"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais","sameAs":["https:\/\/statorials.org\/pt"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/comments?post=1190"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1190\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=1190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=1190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=1190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}