<?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: Dark to light color gradient in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320575#M11228</link>
    <description>&lt;P&gt;Thanks, ChrisNZ! I believe that solution may also work.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2016 18:06:44 GMT</pubDate>
    <dc:creator>hsaul</dc:creator>
    <dc:date>2016-12-21T18:06:44Z</dc:date>
    <item>
      <title>Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319983#M11192</link>
      <description>&lt;P&gt;I recently received a request which may not even be possible, so I wanted to see if the community could offer any insight. I am creating 4 spaghetti plots, positioned side by side using SAS GTL with the lattice statement. &amp;nbsp;Each spaghetti plot has approximately 100 uniquely-colored lines, connecting two points (e.g. Baseline to Time 1), so it is somewhat difficult to identify a trend when I allow SAS to select default colors. &amp;nbsp;The request I received is to assign &lt;EM&gt;dark color shades&lt;/EM&gt; to the increasing lines (i.e. the line the with the greatest positive slope would be colored the darkest) and &lt;EM&gt;light color shades&lt;/EM&gt; to the decreasing lines&amp;nbsp;&lt;SPAN&gt;(i.e. the line the with the greatest negative slope would be colored the lightest)&amp;nbsp;&lt;/SPAN&gt;- or vice versa,&amp;nbsp;in order to create a color shade gradient. Any suggestions would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 18:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319983#M11192</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-19T18:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319985#M11193</link>
      <description>&lt;P&gt;I believe you can accomplish what you want by assigning your slope column to the COLORRESPONSE option and setting the COLORMODEL option to TwoColorRamp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 18:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319985#M11193</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-12-19T18:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319986#M11194</link>
      <description>&lt;P&gt;After posting this reply, I realized that using the COLORRESPONSE option would depend on your data structure. Are you using GROUPed series plots?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 18:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319986#M11194</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-12-19T18:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319988#M11195</link>
      <description>&lt;P&gt;Thanks for your reply! Yes, I am using grouped series plot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;seriesplot y=yvar x=xvar / group=subject;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 18:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/319988#M11195</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-19T18:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320001#M11196</link>
      <description>&lt;P&gt;Thanks again, DanH_sas!&amp;nbsp;The COLORRESPONSE option is working well with the slope variable. &amp;nbsp;However, COLORMODEL appears to be limited in that you can only select a 2 or 3 color ramp. &amp;nbsp;Since I have about 100 unique lines/subjects in each plot, I am seeking a broader range of colors within the gradient. &amp;nbsp;I suppose I can manually assign a list of colors (e.g. COLORMODEL=(black brown ... yellow)), but was just wondering if there's a more automated way. It appears that the non-existent&amp;nbsp;option I am seeking&amp;nbsp;is COLORMODEL=NINTYCOLORRAMP&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320001#M11196</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-19T19:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320006#M11197</link>
      <description>&lt;P&gt;I am curious as to how you intend to compute the slope? Difference betwee final and initial values? Average of slopes for each time segment?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you intend to panel the charts, see the article &lt;A href="http://blogs.sas.com/content/iml/2016/06/02/create-spaghetti-plots-in-sas.html" target="_self"&gt;"Create spaghetti plots in SAS."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help untangle the noodles, you might consider an alternative visualization called the "lasagna plot." See &lt;A href="http://blogs.sas.com/content/iml/2016/06/08/lasagna-plot-in-sas.html" target="_self"&gt;"Lasagna plots in SAS: When spaghetti plots don't suffice,&lt;/A&gt;" which includes a discussion of sorting the rows of a lasagna plot (in your case, by slope).&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320006#M11197</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-12-19T19:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320011#M11198</link>
      <description>&lt;P&gt;Thanks, Rick_SAS! &amp;nbsp;I only have two timepoints, so each line is only a single segment and a single slope can be calculated. &amp;nbsp;I have already created the plots and the panels, so now I'm just noodling over the colors!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will read up on Lasagna Plots to see if this will be a better fit for my data!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320011#M11198</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-19T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320018#M11199</link>
      <description>&lt;P&gt;I see. So you don't actually have a spaghetti plot, which implies multiple time points and segments. You have what is commonly called a "slope chart."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How you visualize the data depends on your audiance, but&amp;nbsp;for an alternate visualization that does&amp;nbsp;notoverlay 100 lines, see my article &lt;A href="http://blogs.sas.com/content/iml/2012/10/15/women-and-jobs.html" target="_self"&gt;"Women and jobs: Redesigning a New York Times graphic."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320018#M11199</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-12-19T19:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320019#M11200</link>
      <description>&lt;P&gt;Slope chart, yes - thank you for that correction! I will reference both of the articles that you provided. Thanks again!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320019#M11200</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-19T19:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320020#M11201</link>
      <description>&lt;P&gt;Just a note. &amp;nbsp;With only two points per line, you could use SERIESPLOT or VECTORPLOT depending on your data structure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a better control on your color gradients, you can use a COLORRESPONSE option with RangeArrtMap instead of ColorModel. &amp;nbsp;A Range attribute map allows you to &lt;STRONG&gt;specify the color (or range) for specific values of your data&lt;/STRONG&gt;. &amp;nbsp;So, for example, you could specify that all slopes&amp;lt; -0.2 should be red, &amp;gt; +0.2 should be green and between -0.2 and +0.2 should be gray. &amp;nbsp;Just like a format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2013/04/14/attributes-map-3-range-attribute-map/" target="_blank"&gt;http://blogs.sas.com/content/graphicallyspeaking/2013/04/14/attributes-map-3-range-attribute-map/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320020#M11201</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-12-19T19:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320377#M11218</link>
      <description>&lt;P&gt;Thank you, Sanjay_SAS! This is the exact solution I have been searching for! I used the sample code from your blog post, but replaced RANGECOLORMODEL with RANGEALTCOLORMODEL in order to apply the colors to a SERIESPLOT (where the lines are considered contrast colors).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;&lt;BR /&gt; do x = 1 to 100;&lt;BR /&gt; subj = 99 + x;&lt;BR /&gt; time0 = rand('normal',4,2);&lt;BR /&gt; time1 = rand('normal',4,2);&lt;BR /&gt; chg = time1 - time0;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=test out=test (rename=(_name_=time col1=value));&lt;BR /&gt; by subj chg;&lt;BR /&gt; var time0 time1;&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt;proc template;&lt;BR /&gt; define statgraph sp; &lt;BR /&gt; begingraph;&lt;BR /&gt; rangeattrmap name='map';&lt;BR /&gt; range min -&amp;lt; 0 / rangealtcolormodel=(red yellow);&lt;BR /&gt; range 0 -&amp;lt; max / rangealtcolormodel=(yellow green);&lt;BR /&gt; endrangeattrmap;&lt;BR /&gt; rangeattrvar attrvar=attrvar var=chg attrmap='map';&lt;BR /&gt; layout overlay / xaxisopts=(display=(ticks tickvalues)) yaxisopts=(display=(ticks tickvalues));&lt;BR /&gt; seriesplot x=time y=value / group=subj colorresponse=attrvar lineattrs=(pattern=1) name='a';&lt;BR /&gt; continuouslegend 'a';&lt;BR /&gt; endlayout;&lt;BR /&gt; endgraph;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;ods html;&lt;BR /&gt;proc sgrender data=test template=sp;&lt;BR /&gt; title 'Gradient Seriesplot';&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6446i1578E212989480C7/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SGRender1.png" title="SGRender1.png" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again!!&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 18:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320377#M11218</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-21T18:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320390#M11219</link>
      <description>&lt;P&gt;If you have fewer than 255 lines and if you are not dedicated to using proc sgrender, sas/graph makes it easy to set line colors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data DIF;
  set TEST;
  DIF=dif(VALUE);
  if TIME='time1';
run;

proc sql noprint;
  select min(DIF), max(DIF) into :min, :max from DIF; 
quit;

data _null_;
  set DIF;
  call execute(cat('symbol',_N_,' color="cx',
                  ifc(DIF&amp;gt;0, put(DIF*255/&amp;amp;max.,hex2.)||'0000"' 
                      ,'00'||put(DIF*255/&amp;amp;min.,hex2.)||'00"')
                  ,' i=j l=1 v=none;'));
run;        

goptions xpixels=800 ypixels=800;
proc gplot data=TEST;
  plot VALUE*TIME=SUBJ/nolegend ;
  run;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6439iCD70DAA994C29042/image-size/original?v=v2&amp;amp;px=-1" alt="2016-12-21_13-30-28.png" title="2016-12-21_13-30-28.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 00:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320390#M11219</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-12-21T00:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320575#M11228</link>
      <description>&lt;P&gt;Thanks, ChrisNZ! I believe that solution may also work.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 18:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320575#M11228</guid>
      <dc:creator>hsaul</dc:creator>
      <dc:date>2016-12-21T18:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dark to light color gradient</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320578#M11230</link>
      <description>&lt;P&gt;Good catch on using RangeAltColorModel for setting contrast colors for the series plot.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 18:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Dark-to-light-color-gradient/m-p/320578#M11230</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-12-21T18:20:17Z</dc:date>
    </item>
  </channel>
</rss>

