I don't know what's wrong with my codes below. The color of y6 symbol in the legend is annoyingly the same with y1, which suffered me a lot.. It should be orange!!!!! How this happens? Anyone can help me out? Thanks.
data mydata;
do i=1 to 10;
x=i;
y1=i*2;
y2=i*3;
y3=i*4;
y4=i*5;
y5=i*6;
y6=i*100;
output;
end;
drop i;
run;
ODS GRAPHICS on/ RESET IMAGENAME = 'Final'
IMAGEFMT =tiff;
ODS LISTING GPATH = 'c:\MyGraphs';
goptions device=png gsfname=output gsfmode=replace xpixels=1200 ypixels=900 xmax=4 in ymax=3 in;
goption reset=global;
goptions ftext='Arial' htext=2 gunit=pct ctext=black;
title1 h=6 f='arial/bo' "This is one figure";
title2 " ";
title3 " ";
title4 " ";
title5 " ";
axis1 label=(f='arial/bo' h=5 "Price") order=(0 to 10 by 1)
value=(f='arial/bo' h=5);
axis2 label=(a=90 f='arial/bo' h=5 "first axis") order=(0 to 100 by 10)
value=(f='arial/bo' h=5);
axis3 label=(a=90 f='arial/bo' h=5 "second axis") order=(100 to 1000 by 100)
value=(f='arial/bo' h=5);
LEGEND1 LABEL=(HEIGHT=1 "") value=(f='arial/bo' h=4) position=(top center outside)
order=("y1" "y2" "y3" "y4" "y5") FWIDTH=40
across=3 down=2 origin=(13 84) mode=share;
LEGEND2 mode=protect LABEL=(HEIGHT=5 '') value=(f='arial/bo' h=4) position=(top center outside) origin=(23 84)pct
order=("y6") FWIDTH=40 mode=share;
symbol1 v=none INTERPOL=join c=blue width=5;
symbol2 v=none INTERPOL=join c=red width=5;
symbol3 v=none INTERPOL=join c=green width=5;
symbol4 v=none INTERPOL=join c=MAGENTA width=5;
symbol5 v=none INTERPOL=join c=CRIMSON width=5;
symbol6 v=none INTERPOL=join c=orange width=5;
proc gplot data=mydata;
plot (y1 y2 y3 y4 y5)*x / overlay frame legend=legend1 haxis=axis1
vaxis=axis2 vref=0 cvref=black;
plot2 y6*x /overlay frame legend=legend2 vaxis=axis3;
run;
quit;
ods listing close;
ods graphics off;
When running your code in my Win7 64bit SAS92 TS Level 2M3 environment I'm getting an orange line.
SAS/Graph is a world on its own (and not really mine). The only thing I can think of is that may be someone stuffed up the color table.
If this is true then using a RGB value should overcome the problem:
symbol6 v=none INTERPOL=join c='CXFF8000' width=5;
http://support.sas.com/techsup/technote/ts688/ts688.html
HTH
Patrick
Are you getting the orange symbol on in the legend?
I'm getting the orange line on the plot,but in the legend on the top, the symbol of y6 is annoyingly the same as y1.
I tried to use the RGB as you suggested, but the symbol of y6 on in the legend was still blue.
I uploaded the fig. Thanks.
One possibility is that your origin statement for legend2 doesn't have the proper allignment. The following worked for me:
LEGEND2 mode=protect LABEL=(HEIGHT=5 '')
value=(f='arial/bo' h=4)
position=(top center outside) origin=(28.7 84)pct
order=("y6") FWIDTH=40 mode=share;
It's too weird..............
I tried the codes on three computers.............It still did not work.
The color of y6 on the plots is correct (orange), but the color of y6 in the legend is still blue...........................
I'm almost mad.................
art297 编写:
One possibility is that your origin statement for legend2 doesn't have the proper allignment. The following worked for me:
LEGEND2 mode=protect LABEL=(HEIGHT=5 '')
value=(f='arial/bo' h=4)
position=(top center outside) origin=(28.7 84)pct
order=("y6") FWIDTH=40 mode=share;
Yes............I found where the problem is
plot2 y6*x=6 /overlay frame legend=legend2 vaxis=axis3;
Thanks all!!!!!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.