BookmarkSubscribeRSS Feed
TomiKong
Fluorite | Level 6

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;

5 REPLIES 5
Patrick
Opal | Level 21

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

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#colors-specify-co...

HTH

Patrick

TomiKong
Fluorite | Level 6

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.


test.JPG
art297
Opal | Level 21

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;

TomiKong
Fluorite | Level 6

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;

TomiKong
Fluorite | Level 6

Yes............I found where the problem is

plot2 y6*x=6 /overlay frame legend=legend2 vaxis=axis3;

Thanks all!!!!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1325 views
  • 6 likes
  • 3 in conversation