<?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: Creating a Very Simple Legend in GPLOT: How? in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870691#M17138</link>
    <description>&lt;P&gt;By "The asterisks are circles of different colors." do you mean the DOT that the SYMBOL statement is using in the plots or do you mean an actual circle?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;PRE&gt;legend1 label=(position=(bottom left) "Treatment") across=2
        value=('Superdrug' 'Placebo')
;&lt;/PRE&gt;
&lt;P&gt;would attempt to use the plot symbols in the legend. But when you have 4 plot statements then getting legends to align can be a bit difficult.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically you it would be a better idea to arrange a variable that indicates the plot result instead of two plot statements:&lt;/P&gt;
&lt;P&gt;Instead of something like:&lt;/P&gt;
&lt;PRE&gt; plot mean1*avisitn  mean2*avisitn&lt;/PRE&gt;
&lt;P&gt;would be&lt;/P&gt;
&lt;PRE&gt;Plot mean*avisitn=groupvar&lt;/PRE&gt;
&lt;P&gt;Where Groupvar would hold information like 'Superdrug' or 'Placebo'.&lt;/P&gt;
&lt;P&gt;Data would look like&lt;/P&gt;
&lt;PRE&gt;mean avisitn groupvar
.5       1         Superdrug
.4        2        Superdrug&lt;/PRE&gt;
&lt;P&gt;You might find that the separate legend ends up not even needed if the data is built and better options for the plot data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can look here for what sounds a lot like the same homework from a few years ago where that questioner wanted something a bit more specific that required the annotate facility to draw images and set text:&amp;nbsp; &lt;A href="https://communities.sas.com/t5/Graphics-Programming/GPLOT-Legend-Style/td-p/459544" target="_blank"&gt;https://communities.sas.com/t5/Graphics-Programming/GPLOT-Legend-Style/td-p/459544&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Apr 2023 02:55:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-04-20T02:55:38Z</dc:date>
    <item>
      <title>Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870656#M17137</link>
      <description>&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a simple line plot using prog GPLOT.&amp;nbsp; The only thing I haven't finished is the legend.&amp;nbsp; I've always been bad at them, and usually convince people to accept them as is (I'm very peruasive, ha ha).&amp;nbsp; This time I am trying to improve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The legend I want looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Treatment&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* Superdrug&amp;nbsp; &amp;nbsp; &amp;nbsp;* Placebo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;inside a box, below the plot.&amp;nbsp; The asterisks are circles of different colors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that difficult?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I am currently developing.&amp;nbsp; Thank you, experts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;goptions reset=all  
         gsfmode=replace  
         cback=white 
         gunit=pct 
         rotate=landscape
         ypixels=2000 xpixels=2400 vsize=5in;

ods graphics on / width=9.4 in height=5.5 in noborder;
   
* -------- legend -------------- *;
*legend1 label = ('Treatment')
*        value = (color = black height = 1.5 'Superdrug  '     'Placebo    '  );

* -------- axes ---------------- *;
 
axis1 split  = '|' 
      label  = ('Time Point' h = 12pt)
	  order  = (1 2 3 4 5)
      minor  = none
	  value  = (h = 6pt)
	  offset = (3,3);

axis2 label  = (angle = 90 'Mean Serum TTR (mg/dL) +/- 1 Standard Error' h = 12pt)
      order  = (28 to 32 by 1)
      minor  = none
	  value  = (h = 6pt);

* -------- plot symbols -------- *;

** -- Superdrug -- **;
symbol1 interpol = hiloctj color = green line = 1;                  ** standard error **;
symbol2 interpol = none    color = green value = dot height = 1.4;  ** mean TTR       **;

** -- Placebo ----- **;
symbol3 interpol = hiloctj color = blue line = 2;                   ** standard error **;
symbol4 interpol = none    color = blue value = dot height = 1.8;   ** mean TTR       **;      

proc format;
     value visform 1 = 'Day 28 Pre-dose' 
                   2 = 'Month 3'
                   3 = 'Month 6' 
                   4 = 'Month 9'
                   5 = 'Month 12'; 
     run;

proc gplot data = adttr8;
     plot plotval1*avisitn  mean1*avisitn  plotval2*avisitn  mean2*avisitn / 
          overlay haxis = axis1 vaxis = axis2 /*legend = legend1*/;
	 format avisitn visform. ;
     run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 22:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870656#M17137</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2023-04-19T22:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870691#M17138</link>
      <description>&lt;P&gt;By "The asterisks are circles of different colors." do you mean the DOT that the SYMBOL statement is using in the plots or do you mean an actual circle?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;PRE&gt;legend1 label=(position=(bottom left) "Treatment") across=2
        value=('Superdrug' 'Placebo')
;&lt;/PRE&gt;
&lt;P&gt;would attempt to use the plot symbols in the legend. But when you have 4 plot statements then getting legends to align can be a bit difficult.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically you it would be a better idea to arrange a variable that indicates the plot result instead of two plot statements:&lt;/P&gt;
&lt;P&gt;Instead of something like:&lt;/P&gt;
&lt;PRE&gt; plot mean1*avisitn  mean2*avisitn&lt;/PRE&gt;
&lt;P&gt;would be&lt;/P&gt;
&lt;PRE&gt;Plot mean*avisitn=groupvar&lt;/PRE&gt;
&lt;P&gt;Where Groupvar would hold information like 'Superdrug' or 'Placebo'.&lt;/P&gt;
&lt;P&gt;Data would look like&lt;/P&gt;
&lt;PRE&gt;mean avisitn groupvar
.5       1         Superdrug
.4        2        Superdrug&lt;/PRE&gt;
&lt;P&gt;You might find that the separate legend ends up not even needed if the data is built and better options for the plot data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can look here for what sounds a lot like the same homework from a few years ago where that questioner wanted something a bit more specific that required the annotate facility to draw images and set text:&amp;nbsp; &lt;A href="https://communities.sas.com/t5/Graphics-Programming/GPLOT-Legend-Style/td-p/459544" target="_blank"&gt;https://communities.sas.com/t5/Graphics-Programming/GPLOT-Legend-Style/td-p/459544&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 02:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870691#M17138</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-04-20T02:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870705#M17139</link>
      <description>&lt;P&gt;Thank you, Ballard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I ended doing, after going to the millionth page of a Google search and finding this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/46/723.html" target="_self"&gt;http://support.sas.com/kb/46/723.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this Legend statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;legend1 order=('Superdrug' 'Placebo') label = ('Treatment') frame;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also had to rename two variables, plotval1 and plotval2, to Superdrug and Placebo, respectively.&amp;nbsp; Weird, but it seems okay.&amp;nbsp; I couldn't get the circle plot symbol (when I used the variables that have that symbol associated, I three circles each), but my legend has the green solid line and blue dashed line to match the plot, and even has "Treatment" in it.&amp;nbsp; I think it will be okay.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other problem that I might attack tomorrow is the spacing on the X axis.&amp;nbsp; the values are 28, 91, 183, 274 and 365 (for VISITN, or visit day).&amp;nbsp; I thought they would be spaced according to the value (ie, a smaller gap between 28 and 91 than between 91 and 183.&amp;nbsp; But for some reason they are treated as discrete values and spaced evenly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would prefer this:&lt;/P&gt;&lt;P&gt;---- 28--------- 91----------------------183 ---------------------- 274&amp;nbsp;---------------------- 365&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this:&lt;/P&gt;&lt;P&gt;---- 28---------------------- 91----------------------183 ---------------------- 274&amp;nbsp;---------------------- 365&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 05:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870705#M17139</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2023-04-20T05:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870768#M17140</link>
      <description>&lt;P&gt;Questions about GPLOT should be posted to &lt;STRONG&gt;Programming &amp;gt; Graphics Programming&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 13:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870768#M17140</guid>
      <dc:creator>Madelyn_SAS</dc:creator>
      <dc:date>2023-04-20T13:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870814#M17141</link>
      <description>&lt;P&gt;Okay, sorry, Madelyn.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, world, I finally gave in and switched to use SGPLOT, and solved 99.9% of my issues.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 15:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870814#M17141</guid>
      <dc:creator>davehalltwp</dc:creator>
      <dc:date>2023-04-20T15:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Very Simple Legend in GPLOT: How?</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870816#M17142</link>
      <description>&lt;P&gt;No worries! I only mentioned it because the Graphics community is a better place to engage the graphics coding experts.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 15:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Creating-a-Very-Simple-Legend-in-GPLOT-How/m-p/870816#M17142</guid>
      <dc:creator>Madelyn_SAS</dc:creator>
      <dc:date>2023-04-20T15:21:23Z</dc:date>
    </item>
  </channel>
</rss>

