<?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 Re: How do I control color of individual boxes in a box plot in gplot? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152957#M5714</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure of your SAS version, but the boxplot you describe it simple to do with PROC SGPLOT. Try this example and see if it works for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=sashelp.cars;&lt;/P&gt;&lt;P&gt;vbox mpg_city / category=origin group=type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jun 2014 14:43:43 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2014-06-25T14:43:43Z</dc:date>
    <item>
      <title>How do I control color of individual boxes in a box plot in gplot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152954#M5711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am relatively new to graphing in SAS, but am finding it great to have the level of control it provides.&amp;nbsp; I have succeeded in making a box and whisker plot that meets all my specifications, but one.&amp;nbsp; I have 8 groups (4 classes of each of two groups).&amp;nbsp; I want the boxes of one group to be red, the other to be blue.&amp;nbsp; Group 1 is values 1.0, 2.0, etc.&amp;nbsp; Group 2 is 1.3, 2.3 etc.&amp;nbsp; I want group 1 to be red, group 2 to be blue.&amp;nbsp; I have searched, but have not seen a way to change color of individual boxes.&amp;nbsp; I'm sure there is a more elegant way to do what I want, but would appreciate knowing how to control color of individual box and whisker displays, given the code I have thus far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;set grant.ayp2010w2009_2;&lt;/P&gt;&lt;P&gt;label ma_rg_ach_level_mb09 = "Math 2009 Achievement Level"&lt;/P&gt;&lt;P&gt;new_abc_math_g = "Math 2010 Growth";&lt;/P&gt;&lt;P&gt;if grade = '04' or grade = '05';&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 'NULL' then ma_rg_ach_level_mb09 = ' ';&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 1 and SWD = 'N' then group = 1.0;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 1 and SWD = 'Y' then group = 1.3;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 2 and SWD = 'N' then group = 2.0;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 2 and SWD = 'Y' then group = 2.3;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 3 and SWD = 'N' then group = 3.0;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 3 and SWD = 'Y' then group = 3.3;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 4 and SWD = 'N' then group = 4.0;&lt;/P&gt;&lt;P&gt;if ma_rg_ach_level_mb09 = 4 and SWD = 'Y' then group = 4.3;&lt;/P&gt;&lt;P&gt;proc sort;&lt;/P&gt;&lt;P&gt;by group;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol &lt;/P&gt;&lt;P&gt;value = dot&lt;/P&gt;&lt;P&gt;height = 0.4&lt;/P&gt;&lt;P&gt;interpol = boxtf&lt;/P&gt;&lt;P&gt;width = 3&lt;/P&gt;&lt;P&gt;bwidth = 5&lt;/P&gt;&lt;P&gt;co = BL&lt;/P&gt;&lt;P&gt;cv = VLIGB&lt;/P&gt;&lt;P&gt;mode = include;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;axis1&lt;/P&gt;&lt;P&gt;order = (-3, -2, -1, 0, 1, 2, 3)&lt;/P&gt;&lt;P&gt;label = (f= "Arial/Bold" height = 2.25 angle = 90 'Mathematics Growth Score 2010')&lt;/P&gt;&lt;P&gt;minor = (number = 1) &lt;/P&gt;&lt;P&gt;value = (f= "Arial" height = 1.75)&lt;/P&gt;&lt;P&gt;width = 2&lt;/P&gt;&lt;P&gt;color = black;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;axis2&lt;/P&gt;&lt;P&gt;label = (f= "Arial/Bold" height = 2.25 'Math Proficiency Level 2009')&lt;/P&gt;&lt;P&gt;offset = (5, 5) &lt;/P&gt;&lt;P&gt;value = (f= "Arial" height = 1.75);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gplot data = temp&lt;/P&gt;&lt;P&gt;uniform ;&lt;/P&gt;&lt;P&gt;plot new_abc_math_g*group /&lt;/P&gt;&lt;P&gt;haxis = axis2&lt;/P&gt;&lt;P&gt;vaxis = axis1&lt;/P&gt;&lt;P&gt;hminor = 0&lt;/P&gt;&lt;P&gt;skipmiss ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2014 21:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152954#M5711</guid>
      <dc:creator>acschul3</dc:creator>
      <dc:date>2014-06-23T21:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I control color of individual boxes in a box plot in gplot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152955#M5712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might try adding a variable for colorgroup or some such.&lt;/P&gt;&lt;P&gt;Then the plot statement becomes&lt;/P&gt;&lt;P&gt;plot new_abc_math_gr*group=colorgroup&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And add a symbol2 statement with the color changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 16:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152955#M5712</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-06-24T16:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I control color of individual boxes in a box plot in gplot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152956#M5713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, those changes did indeed produce two different colored box plots.&amp;nbsp; Because both groups are represented in the four categories on the abscissa, the two sets of box plots sit right on top of one another with these changes.&amp;nbsp; I need to offset them from the tick marks so one can see both sets of boxes.&amp;nbsp; I am now playing with my options to get that done.&amp;nbsp; I've tried switching to a numeric variable on the abscissa and changing values of two groups slightly (e.g., 1 becomes .8 for one group and 1.2 for the other group).&amp;nbsp; I guess my other option is to overlay one graph on top of the other with an offset.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 02:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152956#M5713</guid>
      <dc:creator>acschul3</dc:creator>
      <dc:date>2014-06-25T02:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I control color of individual boxes in a box plot in gplot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152957#M5714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure of your SAS version, but the boxplot you describe it simple to do with PROC SGPLOT. Try this example and see if it works for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=sashelp.cars;&lt;/P&gt;&lt;P&gt;vbox mpg_city / category=origin group=type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 14:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152957#M5714</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2014-06-25T14:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I control color of individual boxes in a box plot in gplot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152958#M5715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try making more noticeable changes in the horizontal axis values and possibly adjust the AXIS statement to control tickmarks and such. Also you don't have a units specified for Width or Bwidth in the symbol statement. You may want to use a unit like bwidth=.2in or similar to get finer control of actual widths as the default is Cells which can be largish for some displays.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 14:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-control-color-of-individual-boxes-in-a-box-plot-in/m-p/152958#M5715</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-06-25T14:45:21Z</dc:date>
    </item>
  </channel>
</rss>

