<?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 Beating colourful heart in Valentine's Day Data Viz Challenge</title>
    <link>https://communities.sas.com/t5/Valentine-s-Day-Data-Viz/Beating-colourful-heart/m-p/916115#M12</link>
    <description>&lt;P&gt;Borrowing from one of the sample codes, here is an animated heart with various colours, a rudimentary attempt at a beating heart &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;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="heartbeat.gif" style="width: 480px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93719i212F9E624D0DE7DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="heartbeat.gif" alt="heartbeat.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*generate data for graph;
data need (drop=t);
    do group=12 to 18 by 0.5;

        do t=0 to 2*constant("pi") by 0.01;
            x=group*sin(t)**3;
            y=13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
            output;
        end;
    end;

    do group=18.2 to 12.2 by -0.5;

        do t=0 to 2*constant("pi") by 0.01;
            x=group*sin(t)**3;
            y=13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
            output;
        end;
    end;

run;


*macro to create graph for each heart/colour;
%macro create_graph(group=, color=);

proc sgplot data=need noautolegend;
    *title 'Be my valentine';
    where group=&amp;amp;group.;
    scatter y=y x=x / markerattrs=(symbol=squarefilled color=&amp;amp;color.);
    xaxis display=none;
    yaxis display=none;
run;

%mend;



*create animated graph;
options papersize=('5 in', '3 in') printerpath=gif animation=start 
    animduration=0.2 animloop=yes noanimoverlay nonumber nodate;
ods printer file='/home/fkhurshed/heartbeat.gif';
ods graphics / width=5in height=3in imagefmt=GIF;


data list_data;
    set need;
    by group notsorted;
    retain counter;
    
    array colours (0:8) $8 _temporary_ ("CXa6cee3" "CX1f78b4" "CXb2df8a" "CX33a02c" "CXfb9a99" "CXe31a1c" "CXfdbf6f" "CXff7f00" "CXcab2d6");

    
    if first.group then do;
    counter+1;
    selected_colour = colours(mod(counter, 8));
       str=catt('%create_graph(group=', put(group, best12. -l), ', color=', selected_colour, ');');
       call execute(str);
       output;
    end;
run;


options printerpath=gif animation=stop;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Feb 2024 17:20:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2024-02-14T17:20:44Z</dc:date>
    <item>
      <title>Beating colourful heart</title>
      <link>https://communities.sas.com/t5/Valentine-s-Day-Data-Viz/Beating-colourful-heart/m-p/916115#M12</link>
      <description>&lt;P&gt;Borrowing from one of the sample codes, here is an animated heart with various colours, a rudimentary attempt at a beating heart &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;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="heartbeat.gif" style="width: 480px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93719i212F9E624D0DE7DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="heartbeat.gif" alt="heartbeat.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*generate data for graph;
data need (drop=t);
    do group=12 to 18 by 0.5;

        do t=0 to 2*constant("pi") by 0.01;
            x=group*sin(t)**3;
            y=13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
            output;
        end;
    end;

    do group=18.2 to 12.2 by -0.5;

        do t=0 to 2*constant("pi") by 0.01;
            x=group*sin(t)**3;
            y=13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
            output;
        end;
    end;

run;


*macro to create graph for each heart/colour;
%macro create_graph(group=, color=);

proc sgplot data=need noautolegend;
    *title 'Be my valentine';
    where group=&amp;amp;group.;
    scatter y=y x=x / markerattrs=(symbol=squarefilled color=&amp;amp;color.);
    xaxis display=none;
    yaxis display=none;
run;

%mend;



*create animated graph;
options papersize=('5 in', '3 in') printerpath=gif animation=start 
    animduration=0.2 animloop=yes noanimoverlay nonumber nodate;
ods printer file='/home/fkhurshed/heartbeat.gif';
ods graphics / width=5in height=3in imagefmt=GIF;


data list_data;
    set need;
    by group notsorted;
    retain counter;
    
    array colours (0:8) $8 _temporary_ ("CXa6cee3" "CX1f78b4" "CXb2df8a" "CX33a02c" "CXfb9a99" "CXe31a1c" "CXfdbf6f" "CXff7f00" "CXcab2d6");

    
    if first.group then do;
    counter+1;
    selected_colour = colours(mod(counter, 8));
       str=catt('%create_graph(group=', put(group, best12. -l), ', color=', selected_colour, ');');
       call execute(str);
       output;
    end;
run;


options printerpath=gif animation=stop;
ods printer close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2024 17:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Valentine-s-Day-Data-Viz/Beating-colourful-heart/m-p/916115#M12</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-02-14T17:20:44Z</dc:date>
    </item>
  </channel>
</rss>

