<?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 scatter markers display order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944889#M370216</link>
    <description>&lt;P&gt;I suggest to use an attribute map, this allows you control the appearance of the markers.&lt;/P&gt;
&lt;P&gt;See below for an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics / reset=all;
data attrmap;
  infile cards dsd dlm="," truncover;
  input id $ value $ MARKERTRANSPARENCY MARKERCOLOR $ markersymbol : $32. ;
cards4;
type, Hybrid, 0.8 , pink   , CircleFilled
type, Sedan , 0.8 , green  , CircleFilled
type, Sports, 0.8 , blue   , CircleFilled
type, SUV   , 0.7 , yellow , CircleFilled
type, Truck , 0   , red    , StarFilled
type, Wagon , 0.5 , black  , StarFilled
;;;;

proc sgplot data=sashelp.cars dattrmap=attrmap;
  scatter x=invoice y=horsepower / group=type attrid=type;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also have a look at the GROUPORDER= option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 13:04:01 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2024-09-23T13:04:01Z</dc:date>
    <item>
      <title>SGPLOT scatter markers display order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944686#M370143</link>
      <description>&lt;P&gt;I'm putting several groups of points on the same plot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;SPAN&gt;proc sgplot data=mydata;&lt;BR /&gt;&lt;/SPAN&gt;    styleattrs datasymbols=(circlefilled) datacontrastcolors=(red blue);
	scatter x=xvar y=yvar / group=rate markerattrs=(size=5);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;One of the group (point cloud) is larger and more dense than the other. It is by default displayed on the foreground and obscures the smaller one.&amp;nbsp; I would like to bring the smaller point cloud to the front and larger to the back. Is there a way to manipulate in what sequence the groups are displayed?&lt;/P&gt;
&lt;P&gt;I tried sorting the data in ascending or descending order, but it has no affect on how the points are plotted.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 23:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944686#M370143</guid>
      <dc:creator>Vic3</dc:creator>
      <dc:date>2024-09-19T23:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT scatter markers display order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944703#M370152</link>
      <description>&lt;P&gt;There are several ways to deal with such overlay issues.&lt;/P&gt;
&lt;P&gt;One is to sort the data so that the group values are seen in a different order. Most of these procedures assign the first color/marker/line in the current active ODS STYLE to the first seen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another is to change the ODS style used which would be done as an option on and ODS destination statement such as RTF&lt;/P&gt;
&lt;PRE&gt;ods rtf file="&amp;lt;path&amp;gt;\file.rtf" style=Htmlblue;&lt;/PRE&gt;
&lt;P&gt;The results window uses the ODS HTML output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To provide much more positive control related to colors, sizes, marker symbols, text color, line colors and patterns you can use a DATTRMAP data set to specific properties for specific values of the Group variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach is to add a TRANSPARENCY to the Scatter plot options. A value larger than 0 (but &amp;lt;=1) is a level of transparency. The default is 0 or opaque which obscures completely. If you try TRANSPARENCY= 0.5 you might see some discernible over lay values. If you have lots of points even more transparent may help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Smaller makers or different symbol, such as&amp;nbsp; Circle (unfilled means the lines may intersect but may avoid big blots of color), or Asterisk or Plus signs, which take up less visual space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you provide some example data in the form of a working data step we may be able to suggest exact code that works with your values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;/&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 17:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944703#M370152</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-20T17:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT scatter markers display order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944889#M370216</link>
      <description>&lt;P&gt;I suggest to use an attribute map, this allows you control the appearance of the markers.&lt;/P&gt;
&lt;P&gt;See below for an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics / reset=all;
data attrmap;
  infile cards dsd dlm="," truncover;
  input id $ value $ MARKERTRANSPARENCY MARKERCOLOR $ markersymbol : $32. ;
cards4;
type, Hybrid, 0.8 , pink   , CircleFilled
type, Sedan , 0.8 , green  , CircleFilled
type, Sports, 0.8 , blue   , CircleFilled
type, SUV   , 0.7 , yellow , CircleFilled
type, Truck , 0   , red    , StarFilled
type, Wagon , 0.5 , black  , StarFilled
;;;;

proc sgplot data=sashelp.cars dattrmap=attrmap;
  scatter x=invoice y=horsepower / group=type attrid=type;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also have a look at the GROUPORDER= option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 13:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/944889#M370216</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2024-09-23T13:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT scatter markers display order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/945002#M370255</link>
      <description>&lt;P&gt;Another approach would be to split up the Y value into different variables and use several SCATTER statement. The last SCATTER statement will be the one that is on top of any other.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mycars;
  set sashelp.cars;
  if type = "Truck" then do;
    hp_fore = horsepower;
  end;
  else do;
    hp_back = horsepower;
  end;
run;

proc sgplot data=mycars;
  scatter x=invoice y=hp_back / markerattrs=(symbol=plus ) transparency=0.5 ;
  scatter x=invoice y=hp_fore / ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Sep 2024 06:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPLOT-scatter-markers-display-order/m-p/945002#M370255</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2024-09-24T06:43:27Z</dc:date>
    </item>
  </channel>
</rss>

