<?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: A normal Christmas tree in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/A-normal-Christmas-tree/m-p/953943#M25196</link>
    <description>&lt;P&gt;Rick,&lt;/P&gt;
&lt;P&gt;I have already read your blog .GREAT !&lt;/P&gt;
&lt;P&gt;I think you should rename this post as&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;Fun With SAS ODS Graphics: A normal Christmas tree&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;to make&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628"&gt;@tc&lt;/a&gt;&amp;nbsp; &amp;nbsp; notice it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1734486617018.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103131iCF9979DEDC4688F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1734486617018.png" alt="Ksharp_0-1734486617018.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2024 01:50:54 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-12-18T01:50:54Z</dc:date>
    <item>
      <title>A normal Christmas tree</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/A-normal-Christmas-tree/m-p/953910#M25195</link>
      <description>&lt;P&gt;I'm sure&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628" target="_self"&gt;@tc&lt;/A&gt; will post an awesome Christmas-themed graphic soon, but you can enjoy this one until he does:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="normalTree4.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103117iEB98F92B6899F67C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normalTree4.png" alt="normalTree4.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* A normal Christmas tree: Each branch is a normal PDF (shaded) */
data NormalTree;
array x[101];    /* for efficiency, store (x, phi(x)) values in an array */
array phi[101];
 
/* compute the standard normal PDF on [-xMax,xMax] */
xMax = 2.5;
dx = 2*xMax / (dim(x)-1);        /* step size for x */
do i = 1 to dim(x);
   x[i] = -xMax + (i-1)*dx;      /* the i_th point in [-xMax,xMax] */
   phi[i] = pdf("Normal", x[i]); /* phi(x) is normal PDF */
end;
 
b = 4;     /* width of the tree base; the interval is [-b/2, b/2] */
h = 6;     /* height of tree; the interval is [0, h] */
nSegs = 8; /* number of normal curves to overlay to construct the tree */
 
/* linear transformation of Y from [0,maxPhi] to [0, 2*dy]. Use for ALL branches. */
maxPhi = pdf("Normal", 0);
dy = h / (nSegs+1);  /* height of each normal curve */
do i = 1 to dim(x);
   phi[i] = 2*dy / maxPhi * phi[i];
end;
 
/* Translate curve and baseline up by k*dy units.
   Linearly transform X from [-xMax,xMax] to [-xR, xR].
   If you slice the right triangle with base b/2 and height h 
   at L=k*dy, the width of the slice is xR = (b/2)/h * (h-L) */
do k = 0 to nSegs-1;
   baseline = k*dy;
   xR = (b/2)/h * (h - baseline);
   do i = 1 to dim(x);
      t = xR / xMax * x[i];   /* t is the scaled version of X for k_th branch */
      y = baseline + phi[i];  /* vertically translate Y values */
      output;
   end;
end;
keep k i baseline t y;
run;
 
/* Fill/shade the PDF: https://blogs.sas.com/content/iml/2015/07/20/density-shaded-tails.html */
ods graphics / width=480px height=480px;
title "A Normal Christmas Tree";
proc sgplot data=NormalTree noautolegend aspect=1 noborder;
  band x=t upper=y lower=baseline / group=k fill fillattrs=(color=DarkGreen) outline lineattrs=(color=black);
  xaxis display=none;
  yaxis display=none;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;How did he do that? See&amp;nbsp;&lt;A style="font-family: inherit; background-color: #ffffff;" href="https://blogs.sas.com/content/iml/2024/12/16/normal-christmas-tree.html" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/iml/2024/12/16/normal-christmas-tree.html&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And I acknowledge&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;for &lt;A href="https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Paint-By-Numbers-Xmas-Tree/m-p/909627#M24278" target="_self"&gt;his inspiration last year&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 20:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/A-normal-Christmas-tree/m-p/953910#M25195</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-12-17T20:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: A normal Christmas tree</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/A-normal-Christmas-tree/m-p/953943#M25196</link>
      <description>&lt;P&gt;Rick,&lt;/P&gt;
&lt;P&gt;I have already read your blog .GREAT !&lt;/P&gt;
&lt;P&gt;I think you should rename this post as&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;Fun With SAS ODS Graphics: A normal Christmas tree&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;to make&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628"&gt;@tc&lt;/a&gt;&amp;nbsp; &amp;nbsp; notice it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1734486617018.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103131iCF9979DEDC4688F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1734486617018.png" alt="Ksharp_0-1734486617018.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 01:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/A-normal-Christmas-tree/m-p/953943#M25196</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-12-18T01:50:54Z</dc:date>
    </item>
  </channel>
</rss>

