<?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 Can you have multiple markers for one legend item in SGPLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780334#M22316</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am wondering if it is possible to add multiple symbols to one legend line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the Flowering Status legend:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I would like to have on the same line for 'Flowering', one green, one black, and one goldenrod coloured filled circle (so three circles of different colours) and the same for "Not Flowering' but for open circles.&lt;/P&gt;&lt;P&gt;I have attached the code I used to generate the figure below and what the current figure looks like.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help resolving this conundrum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods graphics on / noborder attrpriority=none imagemap=off antialias imagename="allo" reset=index;
proc sgplot data=test noautolegend noborder;

	styleattrs datacontrastcolors=(goldenrod green black)
			   datacolors=(goldenrod green black)
			   datalinepatterns=(solid)
			   datasymbols=(circlefilled circle);

reg x=logtotclonemass y=logrhiz / group=fate2  nomarkers lineattrs=(thickness=3);
series x=logtotclonemass y=logrhiz / group=fate2 grouporder=reversedata groupms=flowering lineattrs=(thickness=0) markers markerattrs=(size=7) ;

xaxis label="Log aboveground biomass (g)" labelattrs=(color=black size=14) valueattrs=(color=black size=13) ;
yaxis label="Log caudex biomass (g)" labelattrs=(color=black size=14) valueattrs=(color=black size=13) ;

legenditem type=line name="V" / label="Vegetative" lineattrs=(thickness=2 color=green pattern=solid);
legenditem type=line name="R" / label="Reproductive" lineattrs=(thickness=2 color=goldenrod pattern=solid);
legenditem type=line name="D" / label="Dead" lineattrs=(thickness=2 color=black pattern=solid);

legenditem type=marker name="F" / label="Flowering" markerattrs=(symbol=circlefilled color=DAGR);
legenditem type=marker name="NF" / label="Not Flowering" markerattrs=(symbol=circle color=DAGR);

keylegend "V" "R" "D" / location=outside position=bottom noborder down=1 outerpad=(top=6mm) type=line
	title="Fate of Main Stem" titleattrs=(color=black size=13) valueattrs=(color=black size=13);

keylegend "F" "NF" / title="Flowering Status" location=inside position=topleft noborder down=3 /*type=markersymbol*/
	titleattrs=(color=black size=10) valueattrs=(color=black size=10) autoitemsize;

run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="caudex allocation X FATE X FLOWERING.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65721iAF660CE53DE10D26/image-size/large?v=v2&amp;amp;px=999" role="button" title="caudex allocation X FATE X FLOWERING.png" alt="caudex allocation X FATE X FLOWERING.png" /&gt;&lt;/span&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 04:47:09 GMT</pubDate>
    <dc:creator>jenningsa</dc:creator>
    <dc:date>2021-11-16T04:47:09Z</dc:date>
    <item>
      <title>Can you have multiple markers for one legend item in SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780334#M22316</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am wondering if it is possible to add multiple symbols to one legend line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, the Flowering Status legend:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I would like to have on the same line for 'Flowering', one green, one black, and one goldenrod coloured filled circle (so three circles of different colours) and the same for "Not Flowering' but for open circles.&lt;/P&gt;&lt;P&gt;I have attached the code I used to generate the figure below and what the current figure looks like.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help resolving this conundrum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods graphics on / noborder attrpriority=none imagemap=off antialias imagename="allo" reset=index;
proc sgplot data=test noautolegend noborder;

	styleattrs datacontrastcolors=(goldenrod green black)
			   datacolors=(goldenrod green black)
			   datalinepatterns=(solid)
			   datasymbols=(circlefilled circle);

reg x=logtotclonemass y=logrhiz / group=fate2  nomarkers lineattrs=(thickness=3);
series x=logtotclonemass y=logrhiz / group=fate2 grouporder=reversedata groupms=flowering lineattrs=(thickness=0) markers markerattrs=(size=7) ;

xaxis label="Log aboveground biomass (g)" labelattrs=(color=black size=14) valueattrs=(color=black size=13) ;
yaxis label="Log caudex biomass (g)" labelattrs=(color=black size=14) valueattrs=(color=black size=13) ;

legenditem type=line name="V" / label="Vegetative" lineattrs=(thickness=2 color=green pattern=solid);
legenditem type=line name="R" / label="Reproductive" lineattrs=(thickness=2 color=goldenrod pattern=solid);
legenditem type=line name="D" / label="Dead" lineattrs=(thickness=2 color=black pattern=solid);

legenditem type=marker name="F" / label="Flowering" markerattrs=(symbol=circlefilled color=DAGR);
legenditem type=marker name="NF" / label="Not Flowering" markerattrs=(symbol=circle color=DAGR);

keylegend "V" "R" "D" / location=outside position=bottom noborder down=1 outerpad=(top=6mm) type=line
	title="Fate of Main Stem" titleattrs=(color=black size=13) valueattrs=(color=black size=13);

keylegend "F" "NF" / title="Flowering Status" location=inside position=topleft noborder down=3 /*type=markersymbol*/
	titleattrs=(color=black size=10) valueattrs=(color=black size=10) autoitemsize;

run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="caudex allocation X FATE X FLOWERING.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65721iAF660CE53DE10D26/image-size/large?v=v2&amp;amp;px=999" role="button" title="caudex allocation X FATE X FLOWERING.png" alt="caudex allocation X FATE X FLOWERING.png" /&gt;&lt;/span&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 04:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780334#M22316</guid>
      <dc:creator>jenningsa</dc:creator>
      <dc:date>2021-11-16T04:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can you have multiple markers for one legend item in SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780394#M22319</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
if age&amp;gt;14 then do; _w=weight;_h=height;end;
run;


proc sgplot data=class noautolegend;
styleattrs datacontrastcolors=(goldenrod green black)  datacolors=(goldenrod green black) ;
reg x=weight y=height / group=sex  ;
scatter x=_w y=_h/group=sex markerattrs=(symbol=circlefilled);

legenditem type=MARKERLINE name='x'/ label="Vegetative" lineattrs=(color=green pattern=solid) markerattrs=(color=green symbol=circlefilled);
legenditem type=MARKERLINE name='y'/ label="Reproductive" lineattrs=(color=goldenrod  pattern=solid) markerattrs=(color=goldenrod  symbol=circlefilled);
legenditem type=MARKERLINE name='z'/ label="Dead" lineattrs=(color=black  pattern=solid) markerattrs=(color=black  symbol=circlefilled);

legenditem type=MARKERLINE name='x1'/ label="Vegetative" lineattrs=(color=green pattern=solid) markerattrs=(color=green );
legenditem type=MARKERLINE name='y1'/ label="Reproductive" lineattrs=(color=goldenrod  pattern=solid) markerattrs=(color=goldenrod  );
legenditem type=MARKERLINE name='z1'/ label="Dead" lineattrs=(color=black  pattern=solid) markerattrs=(color=black );

keylegend 'x' 'y' 'z' / title="Flowering" across=1 location=inside;
keylegend 'x1' 'y1' 'z1' / title="No Flowering" across=1 location=inside position=w;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Nov 2021 11:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780394#M22319</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-16T11:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can you have multiple markers for one legend item in SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780493#M22322</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is not quite what I am looking for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a picture of what I would like the legend to look like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-11-16 112737.png" style="width: 268px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65766i1142F2C2135D7B0B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-11-16 112737.png" alt="Screenshot 2021-11-16 112737.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 16:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780493#M22322</guid>
      <dc:creator>jenningsa</dc:creator>
      <dc:date>2021-11-16T16:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can you have multiple markers for one legend item in SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780712#M22325</link>
      <description>&lt;P&gt;OK. It is really uneasy . You need adapt it to your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
run;

proc sql ;
create table point as
select min(weight) as x1,max(height) as y1 from class;
quit;
data text;
 set point;
 text_x1=x1-2;text_y1=y1;text='Flowering Status';output;
 text_x1=x1+4;text_y1=y1-1;text='Flowering ';output;
 text_x1=x1+4;text_y1=y1-2;text='Not Flowering';output;
 keep text_x1 text_y1 text;
run;
data point1;
 set point;
y1=y1-1; 
do i=1 to 3;
output;
end;
run;
data point2;
 set point(rename=(x1=x2 y1=y2));
y2=y2-2; 
do j=1 to 3;
output;
end;
run;

data have;
 merge class point1 point2 text;
 if age&amp;gt;14 then do; _w=weight;_h=height;end;
run;



proc sgplot data=have noautolegend;
styleattrs datacontrastcolors=(goldenrod green black)  datacolors=(goldenrod green black) ;
reg x=weight y=height / group=sex  ;

/*scatter x=text_x1 y=text_y1 /markerchar=text;*/
text x=text_x1 y=text_y1 text=text /contributeoffsets=none strip position=right textattrs=(size=10);

scatter x=_w y=_h/group=sex markerattrs=(symbol=circlefilled);
scatter x=x1 y=y1/group=i groupdisplay=cluster CLUSTERWIDTH=0.2  markerattrs=(size=8 symbol=circlefilled);
scatter x=x2 y=y2/group=j groupdisplay=cluster CLUSTERWIDTH=0.2  markerattrs=(size=8);

legenditem type=line  name='x'/ label="Vegetative" lineattrs=(color=green pattern=solid) markerattrs=(color=green symbol=circlefilled);
legenditem type=line  name='y'/ label="Reproductive" lineattrs=(color=goldenrod  pattern=solid) markerattrs=(color=goldenrod  symbol=circlefilled);
legenditem type=line  name='z'/ label="Dead" lineattrs=(color=black  pattern=solid) markerattrs=(color=black  symbol=circlefilled);

keylegend 'x' 'y' 'z' /location=outside position=bottom noborder down=1 outerpad=(top=6mm) type=line
 title="Fate of Main Stem" titleattrs=(color=black size=13) valueattrs=(color=black size=13); ;

xaxis display=(nolabel) offsetmin=0.05;
yaxis display=(nolabel) offsetmin=0.05 offsetmax=0.05;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1637149742849.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65821i1F2BDF978CD8F899/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1637149742849.png" alt="Ksharp_0-1637149742849.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 11:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780712#M22325</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-17T11:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can you have multiple markers for one legend item in SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780831#M22326</link>
      <description>&lt;P&gt;Thank you so much, after adapting it to my code and data it worked perfectly. Mahalo.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 19:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-you-have-multiple-markers-for-one-legend-item-in-SGPLOT/m-p/780831#M22326</guid>
      <dc:creator>jenningsa</dc:creator>
      <dc:date>2021-11-17T19:02:16Z</dc:date>
    </item>
  </channel>
</rss>

