<?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: Changing the Colors in a GTL BLOCKPLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820250#M22928</link>
    <description>&lt;P&gt;Didn't even know that was an option! Fantastic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A follow up question - Using the Axistable statement in an innermargin block, i have been unable to get borders around individual cells like you can using the blockplot statement. But with the blockplot, it doesn't seem like there is a way to specifically or dynamically tell it which colors are to be in which blocks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Outside of your recommendation, &lt;U&gt;&lt;STRONG&gt;which works&lt;/STRONG&gt;&lt;/U&gt;, is there a way to accomplish either borders around the Axistable cells or explicitly tell the blockplot what colors the cells should be based on the value inside them?&amp;nbsp;&lt;/P&gt;
&lt;DIV align="center"&gt;
&lt;DIV id="tinyMceEditorGreyJoy_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72718i1FF2CA331F43BDDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 24 Jun 2022 14:09:31 GMT</pubDate>
    <dc:creator>GreyJoy</dc:creator>
    <dc:date>2022-06-24T14:09:31Z</dc:date>
    <item>
      <title>Changing the Colors in a GTL BLOCKPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820125#M22926</link>
      <description>&lt;P&gt;This should be a simple question. The proc template is used to create the graph output below. All I want to do is change the fill colors of the "COOLING" "REWARMING" and "POST WARMING" blocks at the top. I have played around with the data attribute maps in dataset form as well as using the discreteattrmap in Proc Template.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone point me to how to work these options to get what I need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ideal is:&lt;/P&gt;
&lt;P&gt;cooling=lightgray&lt;/P&gt;
&lt;P&gt;rewarming=lightorange&lt;/P&gt;
&lt;P&gt;post-warming=lightgray&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph Temperature_overall1 ;
 		begingraph ;
	 		layout lattice / columns=1 rows=1  ;
			
				cell;
					layout lattice / rowweights=(.04 .96);	

					blockplot x=&amp;amp;x. block=block / datatransparency=.3 valuefitpolicy=shrink  labelposition=left
										            display=(fill label outline values)  valuehalign=center ;

					layout overlay /yaxisopts=(griddisplay=on labelattrs=(color=black) tickvalueattrs=(color=black)  
												linearopts=( viewmin=30 viewmax=40 ) display=(Line ticks tickvalues))
									xaxisopts=(labelattrs=(color=black) tickvalueattrs=(color=black) display=(Line ticks tickvalues) 
												linearopts=( viewmin=0 viewmax=100 ))
												;
						seriesplot x=&amp;amp;x. y=sub_avg / group=zsubjectid lineattrs=(color=black THICKNESS=1 pattern=1)  markerattrs=(size=0) DATATRANSPARENCY=.6 ;
						referenceline x=cool_ref / lineattrs=(color=black pattern=2);
						referenceline x=warm_ref / lineattrs=(color=black pattern=2);
						
						annotate;	
					endlayout;
					endlayout;
				endcell;

			endlayout;
		endgraph;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 624px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72690i4A12BD0F54B7BEE0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 18:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820125#M22926</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2022-06-23T18:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Colors in a GTL BLOCKPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820230#M22927</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351316"&gt;@GreyJoy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/n0j696v6yqkb79n12zed3am3omcx.htm#p0kd9f9mn4lnhmn1ege4whinzih2" target="_blank" rel="noopener"&gt;DATACOLORS= option&lt;/A&gt; of the BEGINGRAPH statement:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;begingraph &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;/ datacolors=(lightgray lightorange lightgray)&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 12:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820230#M22927</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-06-24T12:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Colors in a GTL BLOCKPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820250#M22928</link>
      <description>&lt;P&gt;Didn't even know that was an option! Fantastic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A follow up question - Using the Axistable statement in an innermargin block, i have been unable to get borders around individual cells like you can using the blockplot statement. But with the blockplot, it doesn't seem like there is a way to specifically or dynamically tell it which colors are to be in which blocks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Outside of your recommendation, &lt;U&gt;&lt;STRONG&gt;which works&lt;/STRONG&gt;&lt;/U&gt;, is there a way to accomplish either borders around the Axistable cells or explicitly tell the blockplot what colors the cells should be based on the value inside them?&amp;nbsp;&lt;/P&gt;
&lt;DIV align="center"&gt;
&lt;DIV id="tinyMceEditorGreyJoy_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72718i1FF2CA331F43BDDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Jun 2022 14:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820250#M22928</guid>
      <dc:creator>GreyJoy</dc:creator>
      <dc:date>2022-06-24T14:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Colors in a GTL BLOCKPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820277#M22929</link>
      <description>&lt;P&gt;Discrete attribute maps can be used with block plots. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph block;
begingraph / collation=binary;
DiscreteAttrVar attrvar=MYID_AGE var=AGE attrmap="__ATTRMAP__MYID";
DiscreteAttrMap name="__ATTRMAP__MYID" /;
Value "11" / fillattrs=( color=CXFF0000);
Value "12" / fillattrs=( color=CXFFA500);
Value "13" / fillattrs=( color=CXFFFF00);
Value "14" / fillattrs=( color=CX008000);
Value "15" / fillattrs=( color=CX0000FF);
Value "16" / fillattrs=( color=CX800080);
EndDiscreteAttrMap;
layout overlay / yaxisopts=(labelFitPolicy=Split) xaxisopts=(discreteOpts=(tickvaluefitpolicy=SplitRotate));
   SeriesPlot X=Name Y=Weight / primary=true display=(markers) LegendLabel="Weight" NAME="SERIES";
   InnerMargin / align=bottom;
    BlockPlot X=Name Block=MYID_AGE / Display=( Fill Outline Values Label ) valueFitPolicy=split valueHAlign=center valueVAlign=center;
    EndInnerMargin;
endlayout;
endgraph;
end;
run;

proc sort data=sashelp.class out=class; by age; run;

proc sgrender data=class template=block; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820277#M22929</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-06-24T16:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Changing the Colors in a GTL BLOCKPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820286#M22930</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351316"&gt;@GreyJoy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Didn't even know that was an option! Fantastic.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Neither did I until today. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;A follow up question - Using the Axistable statement in an innermargin block, i have been unable to get borders around individual cells like you can using the blockplot statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see such an option in the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/p0v5nj3waz75w4n1s2y70echq6im.htm" target="_blank" rel="noopener"&gt;documentation of the AXISTABLE statement&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Outside of your recommendation, &lt;U&gt;&lt;STRONG&gt;which works&lt;/STRONG&gt;&lt;/U&gt;, is there a way to ... explicitly tell the blockplot what colors the cells should be based on the value inside them?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a very good question. I'm not really familiar with the GTL. The block plots that I created in the past were done with the BLOCK statement of PROC SGPLOT. There I used the DATTRMAP= option of the PROC SGPLOT statement to reference a dataset assigning colors to values. I was surprised to see that in GTL the assignment seemed to rely on the order of values. Now, upon your follow-up question I remembered a very valuable trick that I learned earlier this year from this posting by &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32" target="_blank" rel="noopener"&gt;Bruno_SAS&lt;/A&gt;: &lt;A href="https://communities.sas.com/t5/SAS-Programming/Background-color-of-legend-in-sgplot/m-p/801686/highlight/true#M315524" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Background-color-of-legend-in-sgplot/m-p/801686/highlight/true#M315524&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I ran my old block plot program with the TMPLOUT= option (of the PROC SGPLOT statement) added. And -- voilà! -- the resulting .sas file revealed the secret how the value-based color assignment can be done in PROC TEMPLATE: Apparently you need to insert a section like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;discreteattrvar attrvar=blockvar var=block attrmap="myattrmap";
discreteattrmap name="myattrmap";
  value "COOLING"      / fillattrs=(color=lightblue);
  value "REWARMING"    / fillattrs=(color=lightorange);
  value "POST-WARMING" / fillattrs=(color=lightgray);
enddiscreteattrmap;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after the BEGINGRAPH statement, where the names "blockvar" and "myattrmap" are arbitrary user-defined names, and then refer to the first of these names in the BLOCK= option of the BLOCKPLOT statement, i.e.&lt;/P&gt;
&lt;PRE&gt;blockplot x=&amp;amp;x. block=&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;blockvar&lt;/STRONG&gt;&lt;/FONT&gt; / ...;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Oops, the &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130" target="_blank" rel="noopener"&gt;master&lt;/A&gt; was faster.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 17:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Changing-the-Colors-in-a-GTL-BLOCKPLOT/m-p/820286#M22930</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-06-24T17:22:00Z</dc:date>
    </item>
  </channel>
</rss>

