<?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: Change Error Bar Line Style by Group in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/725548#M21129</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Errorbar attributes: For grouped data, the linestyle and linethickness attributes come from the GraphError style element and the&amp;nbsp;ContrastColor attribute comes from the GraphData1-GraphDataN style elements. This means the&amp;nbsp;linestyle and linethickness attributes are fixed and the only attribute that can differ between groups is the&amp;nbsp;ContrastColor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A solution is to draw the errorbars by overlaying a highlowplot over the scatterplot, see solution below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data graphdata; 
input _PREDICTED _XCLAS _GROUP2 _UCLM _LCLM;
datalines;
 0.50  2  1  0.55  0.44
 0.46  3  1  0.52  0.41
 0.43  4  1  0.50  0.36
 0.28  2  2  0.41  0.15
 0.36  3  2  0.51  0.22
 0.46  4  2  0.55  0.38
 ;
run;

ods graphics / attrpriority=none;

proc sgplot data=graphdata noautolegend;
	styleattrs DataContrastColors=(CX000000 CXA4A5A4) 
			   DataLinePatterns=(1 2) 
			   DataSymbols=(circlefilled trianglefilled);
			   
	scatter x=_XCLAS y=_PREDICTED / 
		group=_GROUP2;
		
	highlow x=_XCLAS low=_LCLM high=_UCLM /
		group=_GROUP2
		highcap=serif
		lowcap=serif;
run;
	&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 11 Mar 2021 18:46:13 GMT</pubDate>
    <dc:creator>Athenkosi</dc:creator>
    <dc:date>2021-03-11T18:46:13Z</dc:date>
    <item>
      <title>Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721340#M21086</link>
      <description>&lt;P&gt;Is there anyway to alter the style of error bars by group in regards to line style or thickness?&lt;/P&gt;
&lt;P&gt;I'm working on a graph where the error bars overlap, so I want them to appear distinct on the graph.&lt;/P&gt;
&lt;P&gt;I've attempted with SGPLOT and SGDESIGN, but have only been able to differentiate the groups by color.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not want to stagger the bars using the cluster option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These are examples of the code I'm working with.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc template;
define statgraph sgdesign;
dynamic __XCLAS __PREDICTED __UCLM __LCLM __GROUP2;
begingraph / dataskin=none attrpriority=Auto DataColors=(CX000000 CX848284) DataContrastColors=(CX000000 CXA4A5A4) DataLinePatterns=(4 1) DataSymbols=(circlefilled trianglefilled);
   layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;
      scatterplot x=__XCLAS y=__PREDICTED / group=__GROUP2 yerrorupper=__UCLM yerrorlower=__LCLM name='scatter' groupdisplay=Overlay errorbarattrs=(thickness=1);
   endlayout;
endgraph;
end;
run;

proc sgrender data=B.EFFECTPLOTRAWDATA1 template=sgdesign;
dynamic __XCLAS="'_XCLAS'n" __PREDICTED="'_PREDICTED'n" __UCLM="'_UCLM'n" __LCLM="'_LCLM'n" __GROUP2="'_GROUP'n" ;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=b.effectPlotRawData1;
scatter x = _XCLAS y = _PREDICTED / yerrorupper=_UCLM yerrorlower=_LCLM group=_INDEX name='scatter' ERRORBARATTRS=(THICKNESS = 1);
styleattrs datacontrastcolors=(black darkgray) datalinepatterns=(ShortDash LongDash);
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Feb 2021 17:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721340#M21086</guid>
      <dc:creator>moreka</dc:creator>
      <dc:date>2021-02-23T17:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721345#M21087</link>
      <description>&lt;P&gt;Instead of varying the error bar attributes, your best option might be to set GROUPDISPLAY=CLUSTER on the SCATTER plot. Give that a try and see what you think.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 17:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721345#M21087</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2021-02-23T17:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721388#M21092</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I do not want to stagger the bars using the cluster option.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But thank you for the suggestion.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 20:36:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721388#M21092</guid>
      <dc:creator>moreka</dc:creator>
      <dc:date>2021-02-23T20:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721389#M21093</link>
      <description>&lt;P&gt;Can you provide data? Or at least a picture of what you want?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 20:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721389#M21093</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-02-23T20:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721394#M21094</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data graphdata; 
input _PREDICTED _XCLAS _GROUP2 _UCLM _LCLM;
datalines;
 0.50  2  1  0.55  0.44
 0.46  3  1  0.52  0.41
 0.43  4  1  0.50  0.36
 0.28  2  2  0.41  0.15
 0.36  3  2  0.51  0.22
 0.46  4  2  0.55  0.38
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think I will just have to split the groups into two separate scatterplots and apply different styles to each.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 20:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721394#M21094</guid>
      <dc:creator>moreka</dc:creator>
      <dc:date>2021-02-23T20:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721399#M21095</link>
      <description>&lt;P&gt;If you are using ODS HTML, the default style is HTMLBlue, which is set up as an ATTRPRIORITY=COLOR style. If you override this setting, you will get different line patterns for each group. Try adding this setting before you run the graph code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;odd graphics / attrpriority=none;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721399#M21095</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2021-02-23T21:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721408#M21096</link>
      <description>&lt;P&gt;If I am graphing a series, this will let me change the pattern for the lines, but unless I'm using it incorrectly, this does not allow me to change the line pattern on the error bars specifically.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 21:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/721408#M21096</guid>
      <dc:creator>moreka</dc:creator>
      <dc:date>2021-02-23T21:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Change Error Bar Line Style by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/725548#M21129</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Errorbar attributes: For grouped data, the linestyle and linethickness attributes come from the GraphError style element and the&amp;nbsp;ContrastColor attribute comes from the GraphData1-GraphDataN style elements. This means the&amp;nbsp;linestyle and linethickness attributes are fixed and the only attribute that can differ between groups is the&amp;nbsp;ContrastColor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A solution is to draw the errorbars by overlaying a highlowplot over the scatterplot, see solution below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data graphdata; 
input _PREDICTED _XCLAS _GROUP2 _UCLM _LCLM;
datalines;
 0.50  2  1  0.55  0.44
 0.46  3  1  0.52  0.41
 0.43  4  1  0.50  0.36
 0.28  2  2  0.41  0.15
 0.36  3  2  0.51  0.22
 0.46  4  2  0.55  0.38
 ;
run;

ods graphics / attrpriority=none;

proc sgplot data=graphdata noautolegend;
	styleattrs DataContrastColors=(CX000000 CXA4A5A4) 
			   DataLinePatterns=(1 2) 
			   DataSymbols=(circlefilled trianglefilled);
			   
	scatter x=_XCLAS y=_PREDICTED / 
		group=_GROUP2;
		
	highlow x=_XCLAS low=_LCLM high=_UCLM /
		group=_GROUP2
		highcap=serif
		lowcap=serif;
run;
	&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Mar 2021 18:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-Error-Bar-Line-Style-by-Group/m-p/725548#M21129</guid>
      <dc:creator>Athenkosi</dc:creator>
      <dc:date>2021-03-11T18:46:13Z</dc:date>
    </item>
  </channel>
</rss>

