<?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 How to change the position of the legend in SGPlot? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697803#M213324</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following code to plot a graph, however, I find that I cannot change the position of the legend. Is it because I changed the default size of the graph? I tried many times, but the legend position didn't change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / width=12in;
ods graphics on / height=7in;

proc sgplot data=hor;
  keylegend / location=inside position=bottomleft;
  xaxis values=(1 2 3 4 5) label='portfolios';
  yaxis label='betas';
  y2axis label="gamma";
  highlow x=n high=MH low=ML;
  scatter x=n y=e / datalabel;
  scatter x=n y=r / datalabel y2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I appreciate it very much for your warm help!&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2020 06:03:05 GMT</pubDate>
    <dc:creator>xizidememeda</dc:creator>
    <dc:date>2020-11-10T06:03:05Z</dc:date>
    <item>
      <title>How to change the position of the legend in SGPlot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697803#M213324</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following code to plot a graph, however, I find that I cannot change the position of the legend. Is it because I changed the default size of the graph? I tried many times, but the legend position didn't change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / width=12in;
ods graphics on / height=7in;

proc sgplot data=hor;
  keylegend / location=inside position=bottomleft;
  xaxis values=(1 2 3 4 5) label='portfolios';
  yaxis label='betas';
  y2axis label="gamma";
  highlow x=n high=MH low=ML;
  scatter x=n y=e / datalabel;
  scatter x=n y=r / datalabel y2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I appreciate it very much for your warm help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 06:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697803#M213324</guid>
      <dc:creator>xizidememeda</dc:creator>
      <dc:date>2020-11-10T06:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the position of the legend in SGPlot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697816#M213329</link>
      <description>&lt;P&gt;Give us data to plot.&lt;/P&gt;
&lt;P&gt;Use one the SASHELP tables.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 07:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697816#M213329</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-10T07:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the position of the legend in SGPlot?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697907#M213382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/293528"&gt;@xizidememeda&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the following code to plot a graph, however, I find that I cannot change the position of the legend. Is it because I changed the default size of the graph? I tried many times, but the legend position didn't change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / width=12in;
ods graphics on / height=7in;

proc sgplot data=hor;
  keylegend / location=inside position=bottomleft;
  xaxis values=(1 2 3 4 5) label='portfolios';
  yaxis label='betas';
  y2axis label="gamma";
  highlow x=n high=MH low=ML;
  scatter x=n y=e / datalabel;
  scatter x=n y=r / datalabel y2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I appreciate it very much for your warm help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where does your legend appear?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you specify a location that has lots of your plot values the legend is shifted to reduce collisions.&lt;/P&gt;
&lt;P&gt;From the documentation:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV class="xis-procStatement"&gt;
&lt;DIV class="xis-procStatementSyntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-optionalArgGroup"&gt;
&lt;DIV id="p18zrxvo9ttjnqn1ap4qs65w2or3" class="xis-argDescriptionPair"&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;TABLE class="xis-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD rowspan="2" class="xis-summaryDefault"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xis-summaryText"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-summaryText"&gt;If LOCATION=INSIDE is specified, the legend is automatically positioned near an edge of the plot area that has the least amount of collision with the data.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 15:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-position-of-the-legend-in-SGPlot/m-p/697907#M213382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-10T15:29:18Z</dc:date>
    </item>
  </channel>
</rss>

