{"id":3064,"date":"2023-07-19T09:31:24","date_gmt":"2023-07-19T09:31:24","guid":{"rendered":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/"},"modified":"2023-07-19T09:31:24","modified_gmt":"2023-07-19T09:31:24","slug":"desenhe-um-circulo-em-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/","title":{"rendered":"A: como desenhar c\u00edrculos em caminhos: com exemplos"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Voc\u00ea pode usar os seguintes m\u00e9todos para desenhar um c\u00edrculo em um caminho em R:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>M\u00e9todo 1: desenhe um c\u00edrculo usando a base R<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">library<\/span> (plotrix)\n\n<span style=\"color: #008080;\">#create scatterplot<\/span>\nplot(x, y)\n\n<span style=\"color: #008080;\">#add circle at specific (x, y) coordinates with specific radius<\/span>\ndraw.draw. <span style=\"color: #3366ff;\">circle<\/span> (x=3, y=8, radius=.5)\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>M\u00e9todo 2: desenhe um c\u00edrculo usando ggplot2<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <b><span style=\"color: #008000;\">library<\/span> (ggplot2)\n<span style=\"color: #008000;\">library<\/span> (ggforce)\n\n<span style=\"color: #008080;\">#create scatter plot with circle at specific location with specific radius<\/span>\nggplot(data = df, aes(x, y)) +\n  geom_point() +\n  geom_circle(aes(x0=3, y0=8, r=1), inherit. <span style=\"color: #3366ff;\">aes<\/span> = <span style=\"color: #008000;\">FALSE<\/span> ) +\n  coordinate_fixed()\n<\/b><\/pre>\n<p> <span style=\"color: #000000;\">Os exemplos a seguir mostram como usar cada m\u00e9todo na pr\u00e1tica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 1: desenhe um c\u00edrculo usando a base R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Para desenhar um c\u00edrculo em um gr\u00e1fico base R, voc\u00ea deve primeiro instalar e carregar o pacote <strong>plotrix<\/strong> :<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><b>install. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">plotrix<\/span> ')\n<span style=\"color: #008000;\">library<\/span> (plotrix)<\/b><\/span><\/pre>\n<p> <span style=\"color: #000000;\">A seguir, podemos usar a fun\u00e7\u00e3o <strong>draw.circle()<\/strong> do pacote <strong>plotrix<\/strong> para adicionar um c\u00edrculo a uma nuvem de pontos base R:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 2, 2, 3, 3, 4, 8),\n                 y=c(2, 4, 5, 4, 7, 9, 10))\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>plot(df$x, df$y)\n\n<span style=\"color: #008080;\">#add circle\n<\/span>draw.draw. <span style=\"color: #3366ff;\">circle<\/span> (x=3, y=8, radius=.5)<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-26257 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cercler1.jpg\" alt=\"\" width=\"465\" height=\"424\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Voc\u00ea tamb\u00e9m pode usar a fun\u00e7\u00e3o <strong>draw.circle()<\/strong> v\u00e1rias vezes para desenhar v\u00e1rios c\u00edrculos no mesmo caminho:<\/span><\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 2, 2, 3, 3, 4, 8),\n                 y=c(2, 4, 5, 4, 7, 9, 10))\n\n<span style=\"color: #008080;\">#create scatterplot\n<\/span>plot(df$x, df$y)\n\n<span style=\"color: #008080;\">#add multiple circles to plot\n<\/span>draw.draw. <span style=\"color: #3366ff;\">circle<\/span> (x=3, y=8, radius=.5)\ndraw.draw. <span style=\"color: #3366ff;\">circle<\/span> (x=4, y=5, radius=.5, border=' <span style=\"color: #ff0000;\">red<\/span> ', col=' <span style=\"color: #ff0000;\">lightblue<\/span> ', lwd=5, lty=' <span style=\"color: #ff0000;\">dashed<\/span> ')\n<\/span><\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-26258\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cercler2.jpg\" alt=\"desenhe um c\u00edrculo no caminho em R\" width=\"456\" height=\"417\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Observe que v\u00e1rios c\u00edrculos foram adicionados ao gr\u00e1fico nas coordenadas (x, y) que especificamos.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 2: desenhe um c\u00edrculo usando ggplot2<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Para desenhar um c\u00edrculo em um gr\u00e1fico no ggplot2, voc\u00ea deve primeiro instalar e carregar os pacotes <strong>ggplot2<\/strong> e <strong>ggforce<\/strong> :<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><b>install. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">ggplot2<\/span> ')\ninstall. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">ggforce<\/span> ')\n<span style=\"color: #008000;\">library<\/span> (ggplot2)\n<span style=\"color: #008000;\">library<\/span> (ggforce)<\/b><\/span><\/pre>\n<p> <span style=\"color: #000000;\">A seguir, podemos usar a fun\u00e7\u00e3o <strong>geom_circle()<\/strong> do pacote <b>ggforce<\/b> para adicionar um c\u00edrculo a um gr\u00e1fico de dispers\u00e3o em ggplot2:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (x=c(1, 2, 2, 3, 3, 4, 8),\n                 y=c(2, 4, 5, 4, 7, 9, 10))\n\n<span style=\"color: #008080;\">#create scatter plot with circle\n<\/span>ggplot(data = df, aes(x, y)) +\n  geom_point() +\n  geom_circle(aes(x0=3, y0=8, r=1), linetype=' <span style=\"color: #ff0000;\">dashed<\/span> ', color=' <span style=\"color: #ff0000;\">red<\/span> ',\n              fill=' <span style=\"color: #ff0000;\">lightblue<\/span> ', lwd=1.5, inherit. <span style=\"color: #3366ff;\">aes<\/span> = <span style=\"color: #008000;\">FALSE<\/span> ) +\n  coordinate_fixed()<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-26259\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cercler3.jpg\" alt=\"desenhe um c\u00edrculo no ggplot2\" width=\"390\" height=\"446\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">O c\u00edrculo \u00e9 colocado nas coordenadas exatas (x, y) que especificamos.<\/span><\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Nota<\/strong> : Se voc\u00ea n\u00e3o usar o argumento <strong>coord_fixed()<\/strong> , o c\u00edrculo poder\u00e1 aparecer como uma elipse.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Os tutoriais a seguir explicam como realizar outras tarefas comuns em R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/pt\/grafico-de-dispersao-r-com-multiplas-variaveis\/\" target=\"_blank\" rel=\"noopener\">Como criar um gr\u00e1fico de dispers\u00e3o em R com m\u00faltiplas vari\u00e1veis<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/etiqueta-nuvem-de-pontos-r\/\" target=\"_blank\" rel=\"noopener\">Como rotular pontos em um gr\u00e1fico de dispers\u00e3o em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\" target=\"_blank\" rel=\"noopener\">Como adicionar uma equa\u00e7\u00e3o de regress\u00e3o a um gr\u00e1fico em R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Voc\u00ea pode usar os seguintes m\u00e9todos para desenhar um c\u00edrculo em um caminho em R: M\u00e9todo 1: desenhe um c\u00edrculo usando a base R library (plotrix) #create scatterplot plot(x, y) #add circle at specific (x, y) coordinates with specific radius draw.draw. circle (x=3, y=8, radius=.5) M\u00e9todo 2: desenhe um c\u00edrculo usando ggplot2 library (ggplot2) library [&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-3064","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>A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia<\/title>\n<meta name=\"description\" content=\"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, 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\/desenhe-um-circulo-em-r\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, com v\u00e1rios exemplos.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-19T09:31:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cercler1.jpg\" \/>\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\/desenhe-um-circulo-em-r\/\",\"url\":\"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/\",\"name\":\"A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-19T09:31:24+00:00\",\"dateModified\":\"2023-07-19T09:31:24+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, com v\u00e1rios exemplos.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A: como desenhar c\u00edrculos em caminhos: com exemplos\"}]},{\"@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":"A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia","description":"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, 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\/desenhe-um-circulo-em-r\/","og_locale":"pt_PT","og_type":"article","og_title":"A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia","og_description":"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, com v\u00e1rios exemplos.","og_url":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/","og_site_name":"Statorials","article_published_time":"2023-07-19T09:31:24+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/cercler1.jpg"}],"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\/desenhe-um-circulo-em-r\/","url":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/","name":"A: Como desenhar c\u00edrculos em caminhos (com exemplos) - Estatologia","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-19T09:31:24+00:00","dateModified":"2023-07-19T09:31:24+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica como desenhar c\u00edrculos em caminhos em R, com v\u00e1rios exemplos.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/desenhe-um-circulo-em-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"A: como desenhar c\u00edrculos em caminhos: com exemplos"}]},{"@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\/3064","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=3064"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/3064\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=3064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=3064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=3064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}