<?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: Mirror Bar Graph in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919310#M24427</link>
    <description>&lt;P&gt;A bit more practical version:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS graphics / width=1200px height=800px;

%macro plotMe(st,ed,by);
proc sgplot data=have;
	styleattrs datacolors=(teal black);
	hbarparm category=yaxis response=xaxis / group=group nooutline name='x' dataskin=matte;
	scatter x=x2 y=yaxis /DATALABEL=x2DL DATALABELATTRS=(color=white size=12) DATALABELPOS=LEFT markerattrs=(size=0);
	scatter x=x3 y=yaxis /DATALABEL=x3DL DATALABELATTRS=(color=white size=12) DATALABELPOS=RIGHT markerattrs=(size=0);
	xaxis values=(
  %do i=&amp;amp;st. %to &amp;amp;ed. %by &amp;amp;by.;
    &amp;amp;i.
  %end;
  )
  VALUESDISPLAY=(
  %do i=&amp;amp;st. %to &amp;amp;ed. %by &amp;amp;by.;
    "%sysfunc(ABS(&amp;amp;i.))"
  %end;
  ) 
  FITPOLICY=STAGGER
	label= 'Quartile Ranking';
	yaxis label= 'Frequency';
	label group= 'Source';
	title 'Figure 1. Total Correct Per Quartile of Ranking';
run;

%mend plotMe;

%plotMe(-360,360,20);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Mar 2024 14:05:53 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2024-03-07T14:05:53Z</dc:date>
    <item>
      <title>Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919200#M24421</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SAS 9.4, I have the attached dataset. I would like to create a mirror bar chart with the x and y axes as labelled in the datalines and the each side of the mirror being the group variable. Does anyone know any efficient code to make this happen? Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input yaxis $ xaxis group $;
	datalines;
	High		346	AHS
	Middle-High	220	AHS
	Middle-Low	268	AHS
	Low			312	AHS
	High		281	ASP
	Middle-High	276	ASP
	Middle-Low	278	ASP
	Low			248	ASP
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2024 20:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919200#M24421</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2024-03-06T20:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919203#M24422</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;code in this post&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-GCHART-display-variable-in-the-bar/m-p/914690" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Proc-GCHART-display-variable-in-the-bar/m-p/914690&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using SAS 9.4, I have the attached dataset. I would like to create a mirror bar chart with the x and y axes as labelled in the datalines and the each side of the mirror being the group variable. Does anyone know any efficient code to make this happen? Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input yaxis $ xaxis group $;
	datalines;
	High		346	AHS
	Middle-High	220	AHS
	Middle-Low	268	AHS
	Low			312	AHS
	High		281	ASP
	Middle-High	276	ASP
	Middle-Low	278	ASP
	Low			248	ASP
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 20:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919203#M24422</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-03-06T20:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919305#M24425</link>
      <description>&lt;P&gt;Thank you for the direction that was quite helpful. I updated my dataset to accommodate the example code, see attached. I am still having a few issues based on my code.&lt;/P&gt;
&lt;P&gt;1. On the x axis the numbers are negative, is there a way to make both sides of the axis positive?&lt;/P&gt;
&lt;P&gt;2. The labels on the bars show at the extreme ends so that not all of the number is showing, is there a way to center the labels on the bar?&lt;/P&gt;
&lt;P&gt;3. Is there a way to adjust the tick values? I would prefer the value to be in increments of 20. I tried using values=() and listing the values but that has not worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input group $ yaxis $ xaxis x2 x3;
	datalines;
	AHS	High		346	 346 .	
	AHS	Middle-High	220  220 .	
	AHS	Middle-Low	268	 268 .	
	AHS	Low			312	 312 .	
	ASP	High		-281 .	-281
	ASP	Middle-High	-276 .	-276
	ASP	Middle-Low	-278 .	-278
	ASP	Low			-248 .	-248
;
run;

proc sgplot data=have;
	styleattrs datacolors=(teal black);
	hbarparm category=yaxis response=xaxis / group=group nooutline name='x' dataskin=matte;
	scatter x=x2 y=yaxis /markerchar=x2 labelstrip markercharattrs=(color=white size=12);
	scatter x=x3 y=yaxis /markerchar=x3 labelstrip markercharattrs=(color=white size=12);
	xaxis values=(-360 -340 -320 -300 -380 -260 -240 -220 -200 -180 -160 -140 -120 -100 -80 -60 -40 -20 0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360) 
	label= 'Quartile Ranking';
	yaxis label= 'Frequency';
	label group= 'Source';
	title 'Figure 1. Total Correct Per Quartile of Ranking';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2024 13:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919305#M24425</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2024-03-07T13:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919307#M24426</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input group $ yaxis $ xaxis x2 x3;
  x2DL=abs(x2);
  x3DL=abs(x3);

	datalines;
	AHS	High		346	 346 .	
	AHS	Middle-High	220  220 .	
	AHS	Middle-Low	268	 268 .	
	AHS	Low			312	 312 .	
	ASP	High		-281 .	-281
	ASP	Middle-High	-276 .	-276
	ASP	Middle-Low	-278 .	-278
	ASP	Low			-248 .	-248
;
run;

ODS graphics / width=1200px height=800px;
proc sgplot data=have;
	styleattrs datacolors=(teal black);
	hbarparm category=yaxis response=xaxis / group=group nooutline name='x' dataskin=matte;
	scatter x=x2 y=yaxis /DATALABEL=x2DL DATALABELATTRS=(color=white size=12) DATALABELPOS=LEFT markerattrs=(size=0);
	scatter x=x3 y=yaxis /DATALABEL=x3DL DATALABELATTRS=(color=white size=12) DATALABELPOS=RIGHT markerattrs=(size=0);
	xaxis values=(-360 -340 -320 -300 -380 -260 -240 -220 -200 -180 -160 -140 -120 -100 -80 -60 -40 -20 
               0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360) 
  VALUESDISPLAY=("360" "340" "320" "300" "380" "260" "240" "220" "200" "180" "160" "140" "120" "100" "80" "60" "40" "20" 
                "0" "20" "40" "60" "80" "100" "120" "140" "160" "180" "200" "220" "240" "260" "280" "300" "320" "340" "360") 
  FITPOLICY=STAGGER
	label= 'Quartile Ranking';
	yaxis label= 'Frequency';
	label group= 'Source';
	title 'Figure 1. Total Correct Per Quartile of Ranking';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1709820065915.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94463i67C7240B95143EDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1709820065915.png" alt="yabwon_0-1709820065915.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 14:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919307#M24426</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-03-07T14:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919310#M24427</link>
      <description>&lt;P&gt;A bit more practical version:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS graphics / width=1200px height=800px;

%macro plotMe(st,ed,by);
proc sgplot data=have;
	styleattrs datacolors=(teal black);
	hbarparm category=yaxis response=xaxis / group=group nooutline name='x' dataskin=matte;
	scatter x=x2 y=yaxis /DATALABEL=x2DL DATALABELATTRS=(color=white size=12) DATALABELPOS=LEFT markerattrs=(size=0);
	scatter x=x3 y=yaxis /DATALABEL=x3DL DATALABELATTRS=(color=white size=12) DATALABELPOS=RIGHT markerattrs=(size=0);
	xaxis values=(
  %do i=&amp;amp;st. %to &amp;amp;ed. %by &amp;amp;by.;
    &amp;amp;i.
  %end;
  )
  VALUESDISPLAY=(
  %do i=&amp;amp;st. %to &amp;amp;ed. %by &amp;amp;by.;
    "%sysfunc(ABS(&amp;amp;i.))"
  %end;
  ) 
  FITPOLICY=STAGGER
	label= 'Quartile Ranking';
	yaxis label= 'Frequency';
	label group= 'Source';
	title 'Figure 1. Total Correct Per Quartile of Ranking';
run;

%mend plotMe;

%plotMe(-360,360,20);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2024 14:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919310#M24427</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-03-07T14:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919312#M24428</link>
      <description>This is perfect. Thank you</description>
      <pubDate>Thu, 07 Mar 2024 14:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919312#M24428</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2024-03-07T14:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Mirror Bar Graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919328#M24429</link>
      <description>&lt;P&gt;For anyone looking at this thread, I believe that the "mirror bar" graph is more commonly called a &lt;A href="https://datavizproject.com/data-type/butterfly-chart/" target="_self"&gt;&lt;EM&gt;butterfly plot&lt;/EM&gt;&lt;/A&gt;&amp;nbsp;or sometimes a &lt;EM&gt;tornado chart&lt;/EM&gt;. For information about creating a butterfly plot in SAS, see&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2012/07/23/butterfly-plots/" target="_self"&gt;Butterfly Plots&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/23/butterfly-plot.html" target="_self"&gt;A Butterfly Plot for Comparing Distributions&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://www.pharmasug.org/proceedings/2020/DV/PharmaSUG-2020-DV-148.pdf" target="_self"&gt;Butterfly Plot for Comparing Two Treatment Responses&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 07 Mar 2024 15:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Mirror-Bar-Graph/m-p/919328#M24429</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-03-07T15:59:03Z</dc:date>
    </item>
  </channel>
</rss>

