<?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: Series and scatter plot with jittering for time in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798052#M22614</link>
    <description>&lt;P&gt;I have moved your post to the "Graphics Programming" board.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 15:36:48 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2022-02-23T15:36:48Z</dc:date>
    <item>
      <title>Series and scatter plot with jittering for time</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798047#M22613</link>
      <description>&lt;P&gt;I want to make a graph that is density (PCRQ) by study day (DAY) with a line for each subject (ID), and I want the graph for each CHMI. Something like below, but I need to account for multiple measurements within the same study day. I was told to jitter the graph to account for the different times, but I am not very familiar with how that works. Example code seems to jitter based on one of the axis, but I have time separate from day. &lt;STRONG&gt;Do I need to combine my day and time columns? If so, what is the best way to go about that?&amp;nbsp;&lt;/STRONG&gt;Study day 1, 2, etc. will not be the same date for everyone, so I don't think a DATETIME format would work.&lt;STRONG&gt; Additionally, how do you assign specific colors to each subject?&lt;/STRONG&gt; Since there will be multiple graphs (one for each CHMI), I want to keep consistent colors for each subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input id $ chmi day time $ pcrr pcrq @@;
 cards;
 A	1	6	08:55	1	33.86
 A	1	9	10:30	1	36.21
 A	1	12	07:57	0	1
 A	1	15	09:13	0	1
 A	2	6	12:10	1	27.9
 A	2	9	02:50	0	1
 A	2	12	06:00	0	1
 A	3	6	09:21	0	1
 A	3	9	13:56	1	30.56
 A	3	9	15:29	1	33.27
 A	3	12	15:09	1	32.87
 A	3	15	12:42	0	1
 B	1	6	09:17	1	30.81
 B	1	6	13:12	1	29.66
 B	1	9	10:49	1	35.08
 B	1	12	11:03	0	1
 B	1	15	18:24	0	1
 B	2	6	17:31	1	28.56
 B	2	9	16:01	1	34.01
 B	2	12	17:23	1	33.56
 B	2	15	09:00	0	1
 B	3	6	17:55	1	28.63
 B	3	9	09:32	1	31.97
 B	3	9	10:54	1	30.04
 B	3	12	07:23	1	27.68
 B	3	15	11:31	0	1
 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data= have (where= (chmi= 1));
 series x= day y= pcrq / group= id;
 scatter x= day y= pcrq / group= id jitter= uniform;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Desired output graph similar to:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariko5797_0-1645629195678.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68771i255066EDA1ED933E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariko5797_0-1645629195678.png" alt="mariko5797_0-1645629195678.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 15:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798047#M22613</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2022-02-23T15:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Series and scatter plot with jittering for time</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798052#M22614</link>
      <description>&lt;P&gt;I have moved your post to the "Graphics Programming" board.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 15:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798052#M22614</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-02-23T15:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Series and scatter plot with jittering for time</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798111#M22615</link>
      <description>&lt;P&gt;Here are some thoughts for you:&lt;/P&gt;
&lt;P&gt;1. Use and "attributes map" to associate visual attributes (like color) to a group value (see the code below).&lt;/P&gt;
&lt;P&gt;2. You can use a BY-group with SGPLOT to get a graph per CHMI value (sort your data by CHMI). You might also like to use SGPANEL to see them together for comparison (see the code below)&lt;/P&gt;
&lt;P&gt;3. I would use a data step to take the day and time values and turn them into a factional day value (e.g. 1.15, 1.5, etc). You will then get the "jittering" effect you want. Use the INTEGER option on the XAXIS or COLAXIS statements to make sure the axis shows the days as whole numbers.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data attrmap;
retain id "patient";
length linecolor $ 6 markercolor $ 6;
input value $ linecolor $ markercolor $;
cards;
A purple purple
B green  green
;
run;

proc sgpanel data=have dattrmap=attrmap;
panelby chmi / layout=rowlattice;
 colaxis integer;
 series x= day y= pcrq / group= id attrid=patient markers;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Feb 2022 17:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Series-and-scatter-plot-with-jittering-for-time/m-p/798111#M22615</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-02-23T17:11:22Z</dc:date>
    </item>
  </channel>
</rss>

