{"id":110,"date":"2015-05-30T20:53:33","date_gmt":"2015-05-30T20:53:33","guid":{"rendered":"http:\/\/blog.ufes.br\/fabiomolinares\/?p=110"},"modified":"2015-05-30T20:53:48","modified_gmt":"2015-05-30T20:53:48","slug":"decimal-places-in-r-plot-legend","status":"publish","type":"post","link":"https:\/\/blog.ufes.br\/fabiomolinares\/2015\/05\/30\/decimal-places-in-r-plot-legend\/","title":{"rendered":"Decimal places in R plot legend?"},"content":{"rendered":"<p>For specifying the number of digits, tipically we use the command\u00a0<code><strong>round<\/strong>, for example: <\/code><\/p>\n<p style=\"text-align: justify\"><code>round(pi, digits=2)<\/code><\/p>\n<p>[1] 3.14<\/p>\n<p>However, we\u00a0can also use <strong><code>sprintf<\/code><\/strong>\u00a0 command to deal with both the number of digits and the + or &#8211; in your equation, for example:<\/p>\n<p>sprinf(&#8220;%3.2f&#8221;,pi)<\/p>\n<p>[1] &#8220;3.14&#8221;<\/p>\n<p><code>Note that, <strong><code>3.2f<\/code><\/strong> controls the number of digits and the symbol\u00a0<strong>%\u00a0<\/strong><\/code>forces the <strong>+<\/strong> or <strong>&#8211;<\/strong> sign in a equation.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For specifying the number of digits, tipically we use the command\u00a0round, for example: round(pi, digits=2) [1] 3.14 However, we\u00a0can also use sprintf\u00a0 command to deal with both the number of digits and the + or &#8211; in your equation, for example: sprinf(&#8220;%3.2f&#8221;,pi) [1] &#8220;3.14&#8221; Note that, 3.2f controls the number of digits and the symbol\u00a0%\u00a0forces [&hellip;]<\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_uag_custom_page_level_css":"","footnotes":""},"categories":[5],"tags":[],"class_list":["post-110","post","type-post","status-publish","format-standard","hentry","category-r"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Fabio Fajardo","author_link":"https:\/\/blog.ufes.br\/fabiomolinares\/author\/fabio-molinares\/"},"uagb_comment_info":189,"uagb_excerpt":"For specifying the number of digits, tipically we use the command\u00a0round, for example: round(pi, digits=2) [1] 3.14 However, we\u00a0can also use sprintf\u00a0 command to deal with both the number of digits and the + or &#8211; in your equation, for example: sprinf(&#8220;%3.2f&#8221;,pi) [1] &#8220;3.14&#8221; Note that, 3.2f controls the number of digits and the symbol\u00a0%\u00a0forces&hellip;","_links":{"self":[{"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":1,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/posts\/110\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ufes.br\/fabiomolinares\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}