<?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: How do I create separate legends for each panel of a stacked bar chart using SGPanel? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565618#M18291</link>
    <description>&lt;P&gt;Since your requirement is for the output to be in one PNG file, the three legends you are proposing would actually take up the same area (or more due to extra titles) in the graph as the one legend you are getting now. So, I'm not sure what you're trying to accomplish. Can you explain further?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 16:45:20 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2019-06-12T16:45:20Z</dc:date>
    <item>
      <title>How do I create separate legends for each panel of a stacked bar chart using SGPanel?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565604#M18288</link>
      <description>&lt;P&gt;I am creating a bar chart with stacked and clustered groups using SGPanel and need a way to create separate legends for each of the panels.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how I am graphing it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel data=DATASET;
  title 'TEST GRAPH';
  panelby var / layout=columnlattice novarname noborder colheaderpos=bottom columns=3;
  vbar year / response=percent group=bin;
  colaxis display=(nolabel) valueattrs=(size=6);
  rowaxis label="Percent" grid valueattrs=(size=6) labelattrs=(size=6);
  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The issue is that within each panel, there are different "bins" so the single legend is massive.&amp;nbsp; An example output graph is attached of what I currently have. I want to instead have a separate legend for each panel (which uses the same colors in each panel for different values).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.png" style="width: 500px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30246i7036C231AF4A4BB7/image-size/large?v=v2&amp;amp;px=999" role="button" title="test.png" alt="test.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 15:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565604#M18288</guid>
      <dc:creator>alawatnuk</dc:creator>
      <dc:date>2019-06-12T15:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create separate legends for each panel of a stacked bar chart using SGPanel?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565605#M18289</link>
      <description>&lt;P&gt;Your better option, in this case, might be to just use a BY-group with SGPLOT. something like this (you might need to PROC SORT your BY var):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=DATASET;
  title 'TEST GRAPH';
  by var;
  vbar year / response=percent group=bin;
  xaxis display=(nolabel) valueattrs=(size=6);
  yaxis label="Percent" grid valueattrs=(size=6) labelattrs=(size=6);
  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use ODS LAYOUT if want them generated side-by-side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;BR /&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 15:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565605#M18289</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2019-06-12T15:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create separate legends for each panel of a stacked bar chart using SGPanel?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565612#M18290</link>
      <description>&lt;P&gt;Hi DanH_sas,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried a bygroup with SGPlot, but what im really looking for is one cohesive plot like SGPanel produces (one single y axis and x axis). Additionally, with ODS Layout I am not able to output the three graphs side by side as one single .png. Any recommendations on how to do the above with SGPlot and ODS Layout?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 16:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565612#M18290</guid>
      <dc:creator>alawatnuk</dc:creator>
      <dc:date>2019-06-12T16:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create separate legends for each panel of a stacked bar chart using SGPanel?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565618#M18291</link>
      <description>&lt;P&gt;Since your requirement is for the output to be in one PNG file, the three legends you are proposing would actually take up the same area (or more due to extra titles) in the graph as the one legend you are getting now. So, I'm not sure what you're trying to accomplish. Can you explain further?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 16:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-create-separate-legends-for-each-panel-of-a-stacked-bar/m-p/565618#M18291</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2019-06-12T16:45:20Z</dc:date>
    </item>
  </channel>
</rss>

