{"id":32,"date":"2014-02-11T15:27:56","date_gmt":"2014-02-11T15:27:56","guid":{"rendered":"http:\/\/ontsandquants.com\/wp\/?p=32"},"modified":"2014-02-11T15:27:56","modified_gmt":"2014-02-11T15:27:56","slug":"ggplot2-color-consistency","status":"publish","type":"post","link":"http:\/\/ontsandquants.com\/wp\/?p=32","title":{"rendered":"ggplot2 Color Consistency"},"content":{"rendered":"<p>I use the ggplot2 package in R for graphics in the analysis I perform for my clients. \u00a0In my current project I am analyzing the performance of 3 systems as compared to a base rate model. \u00a0Some of the charts include the base rate and a ground truth series, some exclude the base rate and some exclude the ground truth. \u00a0By the nature of the alphabetical ordering of the names for the systems, base rate, and ground truth, the color for a given system may be different on different charts. \u00a0It&#8217;s a minor thing, but consistency is better than inconsistency. \u00a0The answer is to use the scale_colour_manual and scale_fill_manual commands in ggplot2 to set the colors. \u00a0I have several lists of color settings, one for each combination that I wish to plot, wherein the color for a given system is consistent across settings. \u00a0Then, when I want to use the color settings I add a statement like &#8220;+ scale_colour_manual(values=&#8217;allSystemColors&#8217;)&#8221; to my ggplot command.<\/p>\n<p>I found the page &lt;http:\/\/sape.inf.usi.ch\/quick-reference\/ggplot2\/colour&gt; to be a handy reference to visually link the name of the color to the color itself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use the ggplot2 package in R for graphics in the analysis I perform for my clients. \u00a0In my current project I am analyzing the performance of 3 systems as compared to a base rate model. \u00a0Some of the charts include the base rate and a ground truth series, some exclude the base rate and &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/ontsandquants.com\/wp\/?p=32\"> <span class=\"screen-reader-text\">ggplot2 Color Consistency<\/span>Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32"}],"collection":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":1,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":33,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/33"}],"wp:attachment":[{"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ontsandquants.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}