<?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: To show selected legends only in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923177#M24524</link>
    <description>&lt;P&gt;Th key here is having only one legend positioned at the top left. To include everything in the legend, remove the NOAUTOLEGEND option and just have one KEY:EGEND statement to telling it move to the top left. If you want only the SERIES plots in the legend, you should do as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;mentioned and use the NAME option on the SERIES plots and list the names on the KEYLEGEND statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's also important to note that a KEYLEGEND statement with no names listed is how you normally control the AUTOLEGEND, but that legend was disabled by the NOAUTOLEGEND option. Normally, the position of a KEYLEGEND statement does not matter, but I'm thinking that a "positional" AUTOLEGEND was created due to these mix of options. As a rule, use "no name" KEYLEGEND statements for only AUTOLEGENDS; otherwise, names should be specified.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2024 14:22:42 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2024-04-05T14:22:42Z</dc:date>
    <item>
      <title>To show selected legends only</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923088#M24521</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to display two series of data (yMean and zMean) with the same axis (month). The code is as below. Somehow there is overlapped legend labels ("Series 1"). Also I don't need "yMean" legend label to show. Can anyone guide to modify my code? Thank you!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods graphics on;&lt;BR /&gt;proc sgplot data=mydata noautolegend;&lt;BR /&gt;series x=Month y=yMean/lineattrs=(color=blue) legendlabel="Series 1"; &lt;BR /&gt;keylegend /location=inside position=topleft;&lt;BR /&gt;scatter x=Month y=yMean/markerfillattrs=(color=blue) ;&lt;BR /&gt;series x=Month y=zMean/lineattrs=(color=red pattern=dash) legendlabel="Series 2"; &lt;BR /&gt;keylegend /location=inside position=topleft;&lt;BR /&gt;scatter x=Monthy=zMean/markerfillattrs=(color=red);&lt;BR /&gt;yaxis values=(0 to 400 by 50) label="Avarage number of Participants";&lt;BR /&gt;xaxis values=(1 to 10 by 1) label="Month";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lichee_1-1712287738545.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95227i242CB8F7355ED63C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lichee_1-1712287738545.png" alt="lichee_1-1712287738545.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 03:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923088#M24521</guid>
      <dc:creator>lichee</dc:creator>
      <dc:date>2024-04-05T03:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: To show selected legends only</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923121#M24523</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430334"&gt;@lichee&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the simplest solution is to reorder the statements:&amp;nbsp;&lt;SPAN&gt;first, the two SERIES statements, then the KEYLEGEND statement (delete the second KEYLEGEND statement -- this causes the overlapped labels) and only after that the SCATTER statements.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you can use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n1jkqnmk6y6ms9n1b2vvubyzqd4a.htm#p1kiiynz0gzidxn16dsf62msnl4tz" target="_blank" rel="noopener"&gt;NAME= option&lt;/A&gt; in the SERIES statements and list the names of interest in the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p0xmbppzx71smbn1203aaif96z86.htm" target="_blank" rel="noopener"&gt;KEYLEGEND statement&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 09:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923121#M24523</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-04-05T09:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: To show selected legends only</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923177#M24524</link>
      <description>&lt;P&gt;Th key here is having only one legend positioned at the top left. To include everything in the legend, remove the NOAUTOLEGEND option and just have one KEY:EGEND statement to telling it move to the top left. If you want only the SERIES plots in the legend, you should do as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;mentioned and use the NAME option on the SERIES plots and list the names on the KEYLEGEND statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's also important to note that a KEYLEGEND statement with no names listed is how you normally control the AUTOLEGEND, but that legend was disabled by the NOAUTOLEGEND option. Normally, the position of a KEYLEGEND statement does not matter, but I'm thinking that a "positional" AUTOLEGEND was created due to these mix of options. As a rule, use "no name" KEYLEGEND statements for only AUTOLEGENDS; otherwise, names should be specified.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 14:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/To-show-selected-legends-only/m-p/923177#M24524</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-04-05T14:22:42Z</dc:date>
    </item>
  </channel>
</rss>

