<?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 to change color scale of a Heatmap in PROC SGPLOT? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725077#M21116</link>
    <description>&lt;P&gt;Data would be helpful as we have no idea what the distribution or actual range of your Correlation variable may be.&lt;/P&gt;
&lt;P&gt;If you want specific ranges to display in certain colors look at the RATTRMAP data set option where you provide range of values and colors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example (obviously untested as no data provided)&lt;/P&gt;
&lt;PRE&gt;data clrresp;
   retain id "myid";
   length min $ 5 max $ 5;
   input min $ max $ color $ altcolor $ excludemax excludemin;
datalines;
_min_  0   blue   blue   1  0
0      0   white  white  0  0
0   _max_  red    red    0  1
;

proc sgplot data=CorrLong noautolegend rattrmap=clrresp;
   heatmap x=Variable y=CorrelationID / colorresponse=Correlation name="nope1" discretex
                                        discretey x2axis rattrid=myid;
   text x=Variable y=CorrelationID text=p_value / textattrs=(size=5pt) x2axis name='nope2';
   label correlation='Pearson Correlation';
   yaxis reverse display=(nolabel);
   x2axis display=(nolabel);
   gradlegend   ;

run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Mar 2021 09:08:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-10T09:08:41Z</dc:date>
    <item>
      <title>How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725067#M21115</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to create a Heatmap of inter-biomarker correlations using PROC SGPLOT. However, &amp;nbsp;I repeatedly failed to adjust the color scale. I would like to define white as the "0"-level of Pearson's r, and blue for negative and red for positive values, as I think that this would be the intuitive Interpretation. See the code below. I tried to define colormodel(STARTCOLOR "-1") etc. but this was not helpful at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am grateful for any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and kind regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sgplot&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=CorrLong &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;noautolegend&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;heatmap&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=Variable &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;y&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=CorrelationID / &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;colorresponse&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=Correlation &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;name&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"nope1"&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;discretex&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;discretey&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x2axis&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;colormodel&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=ThreeColorRamp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;text&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=Variable &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;y&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=CorrelationID &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;text&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=p_value / &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;textattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;size&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;pt) &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x2axis&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;name&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'nope2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;label&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; correlation=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'Pearson Correlation'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;yaxis&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;reverse&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(nolabel);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x2axis&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;display&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(nolabel);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;gradlegend&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 07:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725067#M21115</guid>
      <dc:creator>gmgrosse</dc:creator>
      <dc:date>2021-03-10T07:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725077#M21116</link>
      <description>&lt;P&gt;Data would be helpful as we have no idea what the distribution or actual range of your Correlation variable may be.&lt;/P&gt;
&lt;P&gt;If you want specific ranges to display in certain colors look at the RATTRMAP data set option where you provide range of values and colors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example (obviously untested as no data provided)&lt;/P&gt;
&lt;PRE&gt;data clrresp;
   retain id "myid";
   length min $ 5 max $ 5;
   input min $ max $ color $ altcolor $ excludemax excludemin;
datalines;
_min_  0   blue   blue   1  0
0      0   white  white  0  0
0   _max_  red    red    0  1
;

proc sgplot data=CorrLong noautolegend rattrmap=clrresp;
   heatmap x=Variable y=CorrelationID / colorresponse=Correlation name="nope1" discretex
                                        discretey x2axis rattrid=myid;
   text x=Variable y=CorrelationID text=p_value / textattrs=(size=5pt) x2axis name='nope2';
   label correlation='Pearson Correlation';
   yaxis reverse display=(nolabel);
   x2axis display=(nolabel);
   gradlegend   ;

run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Mar 2021 09:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725077#M21116</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-10T09:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725103#M21117</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 11:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725103#M21117</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-10T11:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725174#M21121</link>
      <description>&lt;P&gt;Thank you, but is there also a solution &lt;U&gt;within&lt;/U&gt; PROC SGPLOT?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 15:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725174#M21121</guid>
      <dc:creator>gmgrosse</dc:creator>
      <dc:date>2021-03-10T15:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725195#M21122</link>
      <description>&lt;P&gt;The solution that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;gave is the best SGPLOT solution. The range attribute data set is used by SGPLOT (via the RATTRMAP and RATTRID options) to control how colors are applied to continuous ranges, such as COLORRESPONSE. By using the _min_/_max_ keywords as he did, this data set definition will reflect any COLORRESPONSE data around a 0 inflection point, regardless of data range. What is your concern about this approach?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725195#M21122</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2021-03-10T16:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725205#M21123</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299031"&gt;@gmgrosse&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, but is there also a solution &lt;U&gt;within&lt;/U&gt; PROC SGPLOT?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Provide data and an image of what you expect a result to look like for that example data and maybe.&lt;/P&gt;
&lt;P&gt;What is possible with any graph is very dependent on the data available. For example, if I have exactly two x,y pairs I cannot make much of a polygon shape, there just are not enough points.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Options depend on desired appearance. The only thing you provided along those lines were Heatmap and blue, white, red. Not much to go on, especially without data.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725205#M21123</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-10T16:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725209#M21124</link>
      <description>&lt;P&gt;Thanks very much for your help. Unfortunately, I cannot upload my raw data since these are unpublished so far... Basically, I intend to plot the results from inter-biomarker pearson's correlation. Here is the result of what I previously did:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gmgrosse_0-1615396034048.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55785iEEE9F70D44C73297/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gmgrosse_0-1615396034048.png" alt="gmgrosse_0-1615396034048.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What is intended is the same map, but white shall be coded as 0 and the scale ranging from -1 to +1.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725209#M21124</guid>
      <dc:creator>gmgrosse</dc:creator>
      <dc:date>2021-03-10T17:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to change color scale of a Heatmap in PROC SGPLOT?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725227#M21125</link>
      <description>&lt;P&gt;Maybe an RATTRMAP set like this:&lt;/P&gt;
&lt;PRE&gt;data clrresp;
   retain id "myid";
   length min $ 5 max $ 5;
   input min $ max $ colormodel1 $ colormodel2 $ excludemax excludemin;
datalines;
_min_  0   darkblue   white   1  0
0      0   white  white  0  0
0   _max_  white    darkred    0  1
;&lt;/PRE&gt;
&lt;P&gt;Using the colormodel variables then a scale is created between the values. This should shade the values close to -1 (if your data doesn't have values below that use -1 instead of _min_ , and 1 instead of _max_) as darkblue shading towards white as the values get closer the zero, and white toward darkred from 0 to 1.&lt;/P&gt;
&lt;P&gt;You can provide a single 3 color ramp style object but the rules for which exact value gets the middle color may not yield what you expect/ want with non-symetrical value ranges.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 18:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-change-color-scale-of-a-Heatmap-in-PROC-SGPLOT/m-p/725227#M21125</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-10T18:14:18Z</dc:date>
    </item>
  </channel>
</rss>

