<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Alternating boxplot colors in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128614#M5017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am programming boxplots using proc boxplot with a grouping variable (trt)&lt;/P&gt;&lt;P&gt;The code goes like this:&lt;/P&gt;&lt;P&gt;proc boxplot data = test3 ;&lt;/P&gt;&lt;P&gt;symbol value=dot height=1 c=blue;&lt;/P&gt;&lt;P&gt;plot var1* time (trt) / cframe&amp;nbsp;&amp;nbsp; = vligb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cboxes&amp;nbsp;&amp;nbsp; = dagr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cboxfill =ywh ;&lt;/P&gt;&lt;P&gt;My question is whether there is a way to fill the boxes with aternative colors - since I am comparing 2 treatment groups?&amp;nbsp; The x-axis is arranged such that for for time=1 I have 2 boxes above - one for trt A and one for trt B.&amp;nbsp; After that there is time=2 with 2 boxes above - A and B.&amp;nbsp; I want to differentiate between A and B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2012 18:28:12 GMT</pubDate>
    <dc:creator>natanya</dc:creator>
    <dc:date>2012-05-29T18:28:12Z</dc:date>
    <item>
      <title>Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128614#M5017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am programming boxplots using proc boxplot with a grouping variable (trt)&lt;/P&gt;&lt;P&gt;The code goes like this:&lt;/P&gt;&lt;P&gt;proc boxplot data = test3 ;&lt;/P&gt;&lt;P&gt;symbol value=dot height=1 c=blue;&lt;/P&gt;&lt;P&gt;plot var1* time (trt) / cframe&amp;nbsp;&amp;nbsp; = vligb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cboxes&amp;nbsp;&amp;nbsp; = dagr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cboxfill =ywh ;&lt;/P&gt;&lt;P&gt;My question is whether there is a way to fill the boxes with aternative colors - since I am comparing 2 treatment groups?&amp;nbsp; The x-axis is arranged such that for for time=1 I have 2 boxes above - one for trt A and one for trt B.&amp;nbsp; After that there is time=2 with 2 boxes above - A and B.&amp;nbsp; I want to differentiate between A and B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 18:28:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128614#M5017</guid>
      <dc:creator>natanya</dc:creator>
      <dc:date>2012-05-29T18:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128615#M5018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If none of the built-in boxplots (proc boxplot, gtl, or gplot with interpol=box) support this, you might have to use some custom programming to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example I wrote, that draws basic boxplot geometry with annotate - it would require quite a bit of further customizing to get the exact boxplot you're wanting.&amp;nbsp; You could programmatically control the color of each box (based on values in the data), etc.&amp;nbsp; I guess the 'tough' part would be visually/spatially "grouping" the bars together, since the annotate coordinates are based on gplot, and gplot doesn't have support for official groups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://robslink.com/SAS/book/example10.htm"&gt;http://robslink.com/SAS/book/example10.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&lt;A href="http://robslink.com/SAS/book/example10_info.htm" title="http://robslink.com/SAS/book/example10_info.htm"&gt;http://robslink.com/SAS/book/example10_info.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I describe how the code works, in detail, in my book "SAS/Graph: Beyond the Basics" - it's Example 10, on pp. 65-70.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 13:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128615#M5018</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2012-05-30T13:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128616#M5019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob.&lt;/P&gt;&lt;P&gt;Your code looks quite complicated. It will take me some time.&amp;nbsp; I was hoping for a more "built in" solution. Is there a way to use annotate (with which I'm really not very familiar ) to color every other box? And can I use annotate with proc boxplot?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 14:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128616#M5019</guid>
      <dc:creator>natanya</dc:creator>
      <dc:date>2012-05-30T14:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128617#M5020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The answer depends on which release you are using.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At SAS 9.2 - A simple &lt;STRONG&gt;(non-grouped)&lt;/STRONG&gt; Horizontal box plot can be made as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=sashelp.cars;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hbox horsepower / category=type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="HBox.png" class="jive-image" src="https://communities.sas.com/legacyfs/online/2106_HBox.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At SAS 9.3 - A &lt;STRONG&gt;grouped&lt;/STRONG&gt; Horizontal box plot can be made as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=sashelp.cars;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hbox horsepower / category=type group=origin groupdisplay=cluster;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="HBox_Group1.png" class="jive-image" src="https://communities.sas.com/legacyfs/online/2109_HBox_Group1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, you may not have SAS 9.3, in which case you can use SAS 9.2 GTL by overlaying two box plots, and use DiscreteOffsets to position them side by side.&amp;nbsp; See this article on &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2012/02/16/distribution-of-maximum-lft-by-treatment/"&gt;Distribution of Max LFT&lt;/A&gt;. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 14:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128617#M5020</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2012-05-30T14:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128618#M5021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... here's a 'non-SG solution' ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made up some data similar to yours (sort of, maybe you can tweak your data a little to match what I used)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the CBOXFILL=(variable) option to change colors according to treatment ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;array color(2) $4 _temporary_ ('red' 'blue');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do time=1 to 5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do trt=1 to 2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;* vary color by treatment;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; c=color(trt);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; n+1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;* 100 observations at each time/treatment combo;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do k=1 to 100;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; var1 = ceil(trt*500*ranuni(0));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;drop k;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc sort data=x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;by n;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;value trt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;1='TRT:A' 2='TRT:B';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;value tm&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;1='TIME 1' 2='TIME 2' 3='TIME 3' 4='TIME 4' 5='TIME 5';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;goptions reset=all gunit=pct ftext='calibri' htext=2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;axis1 value=none label=none major=none ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;axis2 label=('VARIABLE 1');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;* white space around plot;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;title1 ls=2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;title2 a=90 ls=2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;title3 a=-90 ls=2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;footnote1 ls=2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc boxplot data=x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;plot var1*n(trt time) / cboxfill=(c) haxis=axis1 vaxis=axis2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;format trt trt. time tm.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11218i70CBA0A376638295/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="boxplot.png" title="boxplot.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 15:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128618#M5021</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-05-30T15:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Alternating boxplot colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128619#M5022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the box plots to alternate colors by assigning the colors based on the treatment and then using the cboxfill=(color variable name) as described above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 18:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Alternating-boxplot-colors/m-p/128619#M5022</guid>
      <dc:creator>natanya</dc:creator>
      <dc:date>2012-05-30T18:49:07Z</dc:date>
    </item>
  </channel>
</rss>

