{"id":5,"date":"2022-11-28T17:29:18","date_gmt":"2022-11-28T17:29:18","guid":{"rendered":"http:\/\/waigen.com\/?p=5"},"modified":"2022-11-28T17:33:53","modified_gmt":"2022-11-28T17:33:53","slug":"r-tips","status":"publish","type":"post","link":"http:\/\/waigen.com\/index.php\/2022\/11\/28\/r-tips\/","title":{"rendered":"R Tips"},"content":{"rendered":"\n<p>Plots<\/p>\n\n\n\n<p>Legends<\/p>\n\n\n\n<p>Usually, R creates legends in a single column.  If you want to have multiple columns in the legend (in base R), use ncol in the legend command.  <a href=\"https:\/\/stackoverflow.com\/questions\/39552682\/base-r-horizontal-legend-with-multiple-rows\">Link<\/a>.<\/p>\n\n\n\n<p>Axes<\/p>\n\n\n\n<p>If the text on an axis&#8217;s ticks is too wide, use str_wrap from stringr to wrap it.  <a href=\"https:\/\/stackoverflow.com\/questions\/21878974\/wrap-long-axis-labels-via-labeller-label-wrap-in-ggplot2\">Link<\/a>.<\/p>\n\n\n\n<p>When you are trying to shrink the text on x-axis labels, use cex.names.  <a href=\"https:\/\/stackoverflow.com\/questions\/20745426\/cex-axis-only-affects-y-axis-not-x-axis\">Link<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Plots Legends Usually, R creates legends in a single column. If you want to have multiple columns in the legend (in base R), use ncol in the legend command. Link. Axes If the text on an axis&#8217;s ticks is too wide, use str_wrap from stringr to wrap it. Link. When you are trying to shrink [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":3,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":11,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions\/11"}],"wp:attachment":[{"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/waigen.com\/index.php\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}