<?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: Error bars on bargraph overlapping the text inside the bar graph in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930466#M24660</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; for your responses. I tried to recreate the code for what I am looking. in the first bar median number label inside the bar got obstructed by the lower error bar, How I can avoid that, I believe median values always try to fit in the middle of the bar. is it possible to avoid the overwriting?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1717181975045.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96891i8624C241018BB420/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1717181975045.png" alt="SASuserlot_0-1717181975045.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format;
   value fail
      1='fail'
      2='pass';
   value grade
      1='11grade'
      2='10grade';
run;
data chek;
median =0.60;
  q1 = 0.25;
  q3 =1.5;
  mean =1.02;
  group = 'One';
      groupn =1;
	  x=0.2;
	    n =25;

	  paramcd = 'FAIL';
	  paramcdn =1;
	  min =0;
	  max =2;
  output;



median =0.25;
  q1 = 0.36;
  q3 =1.5;
  mean =1.02;
  group = 'TWO';
      groupn =2;
	  x=0.2;
	    n =25;
	  min =0;
	  max =2;
	  paramcd = 'FAIL';
	  paramcdn =1;
  output;

run;

ods listing;
   ods graphics/reset imagefmt=png height=5in width=8in ;	
 
   proc template;
      define statgraph template1;
      BeginGraph;
 
 
         layout overlay/xaxisopts=(type=discrete 
										 offsetmin=0.22 offsetmax=0.22 );

 
         barchart x=groupn y=median/group=paramcdn groupdisplay=cluster 
                               clusterwidth=0.4 barwidth=0.8
							   segmentlabel=true  BARLABELFITPOLICY=INSIDEPREFERRED;
		 scatterplot x=groupn y=median/yerrorlower=q1 yerrorupper=q3 
					 group=paramcdn groupdisplay=cluster ;
 
 
 
         endlayout;
      EndGraph;
      end;
   run;

   proc sgrender data=chek template=template1;
      format groupn fail. paramcdn grade.;
   run;
 
ods listing close;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 31 May 2024 18:59:40 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2024-05-31T18:59:40Z</dc:date>
    <item>
      <title>Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930444#M24657</link>
      <description>&lt;P&gt;I am using proc template to generate this kind of graph. What is the option available to auto move the text inside the bars so that it wont collide with error bar graph line. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1717169253430.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96890i78E368F202FD14D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1717169253430.png" alt="SASuserlot_0-1717169253430.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 15:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930444#M24657</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2024-05-31T15:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930448#M24658</link>
      <description>&lt;P&gt;You should include the code defining your template so we can see all of the options in effect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your code/date there are multiple ways to draw "error bars" and not all of them would support the same options, plus need to know the current setting that might effect this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a BARCHARTPARM you might try setting the ERRORBARCAPSHAPE=NONE so there is no line across the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using a HIGHLOWPLOT to overlay error bars you could use the LOWCAP=NONE to suppress caps just on the lower. Or add a variable that contains the type of cap to display and use NONE for just the X values that are having the problem.&lt;/P&gt;
&lt;P&gt;Or adjust the value of the lower bar variable&lt;/P&gt;
&lt;P&gt;Or use TEXTPLOT to display the labels and adjust the location.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 15:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930448#M24658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-31T15:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930449#M24659</link>
      <description>&lt;P&gt;I'm going to assume you are using a BARCHARTPARM statement, with ERRORUPPER and ERRORLOWER and SEGMENTLABELTYPE. The answer to your question depends on the behavior you want. If you want the value to always be right below the error bar, then do the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Remove the ERRORUPPER, ERRORLOWER, and SEGMENTLABELTYPE options.&lt;/LI&gt;
&lt;LI&gt;Add a HIGHLOWPLOT after the BARCHARTPARM, assigning the upper and lower error variable to the plot, adding HIGHCAP=serif, LOWCAP=serif, and &amp;nbsp;the bar value variable to the LOWLABEL option.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;If your goal is to keep the value in the center of the bar, unless the error bar "pushes" it down, you would need to do the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a temporary data set that will add a numeric column for the Y location for the labels (let's call it LabelY) and a string column for text anchor positions (let's call it POS) to the original data. In the data step, the LabelY value should be the lesser of the 1/2 bar value or the lower error value. If you use the bar value, assign "CENTER" to the POS column, else assign "TOP". You will use this data set instead of the original data set.&lt;/LI&gt;
&lt;LI&gt;Remove the&amp;nbsp;SEGMENTLABELTYPE option.&lt;/LI&gt;
&lt;LI&gt;Add a TEXTPLOT after the BARCHARTPARM, using the LabelY column for the Y option and the POS column on the POSITION option.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Let me know if you have any questions or issues with these approaches.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 16:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930449#M24659</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-05-31T16:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930466#M24660</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; for your responses. I tried to recreate the code for what I am looking. in the first bar median number label inside the bar got obstructed by the lower error bar, How I can avoid that, I believe median values always try to fit in the middle of the bar. is it possible to avoid the overwriting?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1717181975045.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96891i8624C241018BB420/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1717181975045.png" alt="SASuserlot_0-1717181975045.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format;
   value fail
      1='fail'
      2='pass';
   value grade
      1='11grade'
      2='10grade';
run;
data chek;
median =0.60;
  q1 = 0.25;
  q3 =1.5;
  mean =1.02;
  group = 'One';
      groupn =1;
	  x=0.2;
	    n =25;

	  paramcd = 'FAIL';
	  paramcdn =1;
	  min =0;
	  max =2;
  output;



median =0.25;
  q1 = 0.36;
  q3 =1.5;
  mean =1.02;
  group = 'TWO';
      groupn =2;
	  x=0.2;
	    n =25;
	  min =0;
	  max =2;
	  paramcd = 'FAIL';
	  paramcdn =1;
  output;

run;

ods listing;
   ods graphics/reset imagefmt=png height=5in width=8in ;	
 
   proc template;
      define statgraph template1;
      BeginGraph;
 
 
         layout overlay/xaxisopts=(type=discrete 
										 offsetmin=0.22 offsetmax=0.22 );

 
         barchart x=groupn y=median/group=paramcdn groupdisplay=cluster 
                               clusterwidth=0.4 barwidth=0.8
							   segmentlabel=true  BARLABELFITPOLICY=INSIDEPREFERRED;
		 scatterplot x=groupn y=median/yerrorlower=q1 yerrorupper=q3 
					 group=paramcdn groupdisplay=cluster ;
 
 
 
         endlayout;
      EndGraph;
      end;
   run;

   proc sgrender data=chek template=template1;
      format groupn fail. paramcdn grade.;
   run;
 
ods listing close;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2024 18:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930466#M24660</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2024-05-31T18:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930482#M24661</link>
      <description>&lt;P&gt;I think your two best options are the second item I mentioned (except you should use "bottom" instead of "top"), or use an AXISTABLE. Here are the code snippets for both:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TEXTPLOT&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
set chek;
length pos $ 6;
if q1 &amp;lt; (median / 2) then do;
   LabelY = q1;
   pos = "bottom";
end;
else do;
   LabelY = median / 2;
   pos = "center";
end;
run;

   proc template;
      define statgraph template1;
      BeginGraph;
         layout overlay/xaxisopts=(type=discrete offsetmin=0.22 offsetmax=0.22 );
         barchart x=groupn y=median/group=paramcdn groupdisplay=cluster
                  clusterwidth=0.4 barwidth=0.8;
         scatterplot x=groupn y=median/yerrorlower=q1 yerrorupper=q3
                     group=paramcdn groupdisplay=cluster ;
         textplot x=groupn y=LabelY text=median / position=pos strip=true 
                     group=paramcdn groupdisplay=cluster ;
         endlayout;
      EndGraph;
      end;
   run;

   proc sgrender data=temp template=template1;
      format groupn fail. paramcdn grade.;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;AXISXTABLE&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
      define statgraph template2;
      BeginGraph;
         layout overlay/xaxisopts=(type=discrete offsetmin=0.22 offsetmax=0.22 );
         barchart x=groupn y=median/group=paramcdn groupdisplay=cluster
                  clusterwidth=0.4 barwidth=0.8;
         scatterplot x=groupn y=median/yerrorlower=q1 yerrorupper=q3
                     group=paramcdn groupdisplay=cluster ;
         innermargin / align=bottom;
            axistable x=groupn value=median / class=paramcdn classdisplay=cluster;
         endinnermargin;
         endlayout;
      EndGraph;
      end;
   run;

   proc sgrender data=chek template=template2;
      format groupn fail. paramcdn grade.;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2024 20:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930482#M24661</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-05-31T20:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error bars on bargraph overlapping the text inside the bar graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930493#M24662</link>
      <description>&lt;P&gt;Text plot worked. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 22:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Error-bars-on-bargraph-overlapping-the-text-inside-the-bar-graph/m-p/930493#M24662</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2024-05-31T22:39:47Z</dc:date>
    </item>
  </channel>
</rss>

