<?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: SGPLOT groups overlapping in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468202#M16114</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211611"&gt;@AHW&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the responses!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So from how I understand it, it's expected for the different groups to overlap on the same axis. Is there any way to color the three groups in a way that preserves the order of the original sorted datasets? For example, if I have the data below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 257px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21070i5D578DDDB889ADCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would want the agencies to be plotted from 1 to 5, left to right, instead of having the Class 1 agencies on top of the Class 0 agencies. Essentially, something like the left graph below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21071i359265F4B1F7A11E/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired.PNG" alt="desired.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To get the behavior on the left you need your X variable to have different values for the groups.&lt;/P&gt;
&lt;P&gt;To get the behavior you have on the right you havethe same value for the XAXIS variable for different groups. So what are the values of the X variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;show actual code that generates the graph on the right with the "data" you are showing above.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jun 2018 21:59:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-06-06T21:59:19Z</dc:date>
    <item>
      <title>SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468122#M16096</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to make a caterpillar style plot using a dataset sorted by median distance. Each point is classified into a group depending on whether or not its Q1/Q3 extends past the overall median.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I plot the data, the three groups are plotted on top of each other as opposed to in their original sorted order. Is there any way to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a picture of the graph:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21068i5D0F3BFFB9D73CA8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the code used to classify and plot the data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data MEDIAN_CLASS;
	set SUMM_SORT (obs=200);
	if _n_=1 then set MEDIAN_VALUE;
	if DISTANCE_Q3&amp;lt;OVERALL_MEDIAN then OUTLIER=0;
	else if DISTANCE_Q1&amp;gt;OVERALL_MEDIAN then OUTLIER=2;
	else OUTLIER=1;
run;

ods graphics on /imagemap=on width=11in;
proc sgplot data=MEDIAN_CLASS noautolegend;
	styleattrs datacontrastcolors=(darkgreen darkblue darkred);
	title "Distance from ";
	refline OVERALL_MEDIAN / lineattrs=(thickness=2);
	scatter x=AGENCY_ID y=DISTANCE_median /group=OUTLIER
		yerrorlower=DISTANCE_Q1 yerrorupper=DISTANCE_Q3 errorbarattrs=(thickness=2) dataskin=sheen;
	xaxis type=discrete discreteorder=data label="Agency"
		labelattrs=(size=12) display=none;
	yaxis type=log label='Distance from(km)' grid labelattrs=(size=12)
		valueattrs=(size=10);
quit;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 16:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468122#M16096</guid>
      <dc:creator>AHW</dc:creator>
      <dc:date>2018-06-06T16:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468145#M16102</link>
      <description>&lt;P&gt;It sounds like you are saying that the green&amp;nbsp;group is displayed first, then the blue group (which might obstruct some of the green), and then the red group (which might obstruct some of the green or blue groups).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, that is how groups are plotted. If you don't want that order, you can use another way to assign colors to the markers and error bars. You didn't post sample code, but try something like this:&lt;/P&gt;
&lt;P&gt;SCATTER ... / colormodel=(darkgreen darkblue darkred) colorresponse=OUTLIER;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if that will color the error bars or not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some sample data would&amp;nbsp;be helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 17:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468145#M16102</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-06-06T17:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468147#M16104</link>
      <description>&lt;P&gt;I could not run your code since the data set SUMM_SORT is not included.&amp;nbsp; You can get some separation of the groups by setting GROUPDISPLAY=cluster.&amp;nbsp; However, since you have a lot of observations, it may not be much.&amp;nbsp; You could also try setting TRANSPARENCY.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 17:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468147#M16104</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2018-06-06T17:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468187#M16113</link>
      <description>&lt;P&gt;Thanks for the responses!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So from how I understand it, it's expected for the different groups to overlap on the same axis. Is there any way to color the three groups in a way that preserves the order of the original sorted datasets? For example, if I have the data below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 257px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21070i5D578DDDB889ADCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would want the agencies to be plotted from 1 to 5, left to right, instead of having the Class 1 agencies on top of the Class 0 agencies. Essentially, something like the left graph below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21071i359265F4B1F7A11E/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired.PNG" alt="desired.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468187#M16113</guid>
      <dc:creator>AHW</dc:creator>
      <dc:date>2018-06-06T21:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468202#M16114</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211611"&gt;@AHW&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the responses!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So from how I understand it, it's expected for the different groups to overlap on the same axis. Is there any way to color the three groups in a way that preserves the order of the original sorted datasets? For example, if I have the data below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 257px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21070i5D578DDDB889ADCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would want the agencies to be plotted from 1 to 5, left to right, instead of having the Class 1 agencies on top of the Class 0 agencies. Essentially, something like the left graph below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21071i359265F4B1F7A11E/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired.PNG" alt="desired.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To get the behavior on the left you need your X variable to have different values for the groups.&lt;/P&gt;
&lt;P&gt;To get the behavior you have on the right you havethe same value for the XAXIS variable for different groups. So what are the values of the X variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;show actual code that generates the graph on the right with the "data" you are showing above.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 21:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468202#M16114</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-06T21:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT groups overlapping</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468373#M16122</link>
      <description>&lt;P&gt;Thanks for the help everyone! I ended up just adding a counter variable and then using that as the x-axis scale. The only disadvantage with this is that hovering over the data in the report shows the counter rather than the id, but that's not a big deal.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 14:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-groups-overlapping/m-p/468373#M16122</guid>
      <dc:creator>AHW</dc:creator>
      <dc:date>2018-06-07T14:17:23Z</dc:date>
    </item>
  </channel>
</rss>

