<?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: PROC SGPLOT and its legend in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227107#M8233</link>
    <description>&lt;P&gt;To be clear to other users, here is the code that successfully produces what I want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=dataset; &lt;BR /&gt; scatter y=Y_var &amp;nbsp; x=X_Var; &lt;BR /&gt; lineparm x=0 y=0 slope=1 / name='xyz'&amp;nbsp; legendlabel = '1 to 1 Line'; &lt;BR /&gt; yaxis label = 'Y-axis Label'; &lt;BR /&gt; xaxis label = 'X-axis Label';&lt;/P&gt;
&lt;P&gt;keylegend 'xyz';&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2015 15:39:16 GMT</pubDate>
    <dc:creator>n6</dc:creator>
    <dc:date>2015-09-24T15:39:16Z</dc:date>
    <item>
      <title>PROC SGPLOT and its legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227085#M8230</link>
      <description>&lt;P&gt;I want to do a Y vs X scatterplot and I want to draw a 45 degree angle line on it so the viewer and easily see what points are above or below the diagonal.&amp;nbsp; Here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=dataset; &lt;BR /&gt; scatter y=Y_var &amp;nbsp; x=X_Var; &lt;BR /&gt; lineparm x=0 y=0 slope=1 / legendlabel = '1 to 1 Line'; &lt;BR /&gt; yaxis label = 'Y-axis Label'; &lt;BR /&gt; xaxis label = 'X-axis Label'; &lt;BR /&gt;run; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the problem.&amp;nbsp; In the legend, in addition to labelling the 45 degree line as "1 to 1 line," it also puts the plotting symbol for the points and labels it with the variable name of the variable on the y-axis. So the legend looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"a circle" Y_var&amp;nbsp;&amp;nbsp; "a line" 1 to 1 Line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It mystifies me why it would put the first part.&amp;nbsp; If you plot y vs x then I don't see a need to label the points with the name of the y-axis variable but SAS Help says that that indeed is what it is supposed to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But anyway, I looked and looked in the help for the SCATTER statement on how to undo that and couldn't figure it out then I came onto this site found the NOAUTOLEGEND statement.&amp;nbsp; Okay, that's good, I missed that because I was looking for options for the SCATTER line whereas NOAUTOLEGEND goes on the PROC SGPLOT line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I add NOAUTOLEGEND and the problem is that it takes away the legend entrely.&amp;nbsp; I want the legend to include only the second part, where it says "1 to 1 line" but it seems I get either whole legend including the first part which is unwanted or else I get no legend at all.&lt;/P&gt;
&lt;P&gt;Any ideas on how to get a legend with only that second part?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227085#M8230</guid>
      <dc:creator>n6</dc:creator>
      <dc:date>2015-09-24T15:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT and its legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227096#M8231</link>
      <description>&lt;P&gt;Add the NAME option to each plot and a KEYLEGEND statement that only references the name of the plot(s) that you want to appear in the legend.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227096#M8231</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-24T15:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT and its legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227101#M8232</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hey, that worked, thanks.&amp;nbsp; Actually I had already tried the NAME thing but I was usinig it incorrectly but your suggestion led me to try it again and now all is good.&amp;nbsp; Thanks again.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227101#M8232</guid>
      <dc:creator>n6</dc:creator>
      <dc:date>2015-09-24T15:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT and its legend</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227107#M8233</link>
      <description>&lt;P&gt;To be clear to other users, here is the code that successfully produces what I want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=dataset; &lt;BR /&gt; scatter y=Y_var &amp;nbsp; x=X_Var; &lt;BR /&gt; lineparm x=0 y=0 slope=1 / name='xyz'&amp;nbsp; legendlabel = '1 to 1 Line'; &lt;BR /&gt; yaxis label = 'Y-axis Label'; &lt;BR /&gt; xaxis label = 'X-axis Label';&lt;/P&gt;
&lt;P&gt;keylegend 'xyz';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-SGPLOT-and-its-legend/m-p/227107#M8233</guid>
      <dc:creator>n6</dc:creator>
      <dc:date>2015-09-24T15:39:16Z</dc:date>
    </item>
  </channel>
</rss>

