现在的位置: 首页 > 综合 > 正文

将单独的图形列在同一张图上—ODS

2018年10月22日 ⁄ 综合 ⁄ 共 2271字 ⁄ 字号 评论关闭

FROM<Multiple Graphs on One page, the easy way (PDF) and the hard way (RTF>

 

 

样本数据:

data spiral;
   do theta=1 to 1080 by .1;
      r=.75 + sin((.25*theta));
      x=r*cos(theta);
      y=r*sin(theta);
      output;
   end;
run;

data star;
   do theta=1 to 1080 by .75;
      r=sin((5)*theta);
      x=r*cos(theta);
      y=r*sin(theta);
      output;
   end;
run;

data colors;
   do theta=1 to 5760 by 1;
      r=sin((sqrt(3/2))*theta);
      x=r*cos(theta);
      y=r*sin(theta);
      z=(round(rannor(0),.01));
      if abs(z) gt 1 then z=1-abs(z);
         output;
   end;
run;
%macro fixsymbols;
%*Used to set symbol definitions for all 99 symbols, which will be used to make the multicolor graph below;
goptions reset=all ;*used color and symbol definitions above,return to default before modifying here;
%do i=1 %to 99;
   symbol&i height=.5 v=dot i=join line=35;
%end;
%mend;
%fixsymbols;                                                                                                                                          
data rose;
   do theta=1 to 360 by .5;
      r=sin((9/2)*theta);
      x=r*cos(theta);
      y=r*sin(theta);
      output;
   end;
run;

作图:

goptions reset=all
device=pdfc
ftext="swissb";
ods pdf file='C:\temp\four in one.pdf' startpage=never;
ods proclabel "Four graphs on one page" ;
goptions hsize=5.20 in vsize=3.75 in;
title1;
proc gplot data=spiral;
   goptions horigin=0in vorigin=3.99 in;
   title2 'PLOT #1-A spiral';
   plot y*x /name="Spiral" noaxes nolegend noframe;
   symbol1 interpol=join width=10 ci=cxEC8B16 cv=cx546EF0
   font=swiss value=-;
run;
quit;                                                                                                                                               
Proc gplot data=star;
   goptions horigin=5.25;
   title2 'PLOT #2-A star';
   plot y*x /nolegend noaxes name="star" noframe;
   symbol1 interpol=join width=10 ci=cxEC8B16 cv=cx546EF0
           font=swiss value=-;
run;
quit;

%fixsymbols;
proc gplot data=colors;
   goptions hsize= 5.20in vsize= 3.75in device=pdfc ftext="swissb"
            horigin=0 in vorigin=0 in ;
*Need the above goptions because of the reset=all in the Macro fixsymbols;
   title2 'PLOT #3-Multicolor "thing"';
   plot y*x=Z / name="Colors" nolegend noaxes noframe;
run;
quit;                                                                                                                                                   
proc gplot data=rose;
   goptions horigin=5.25 in;
   title2 'PLOT #4-A rose';
   plot y*x / name="Rose" noframe nolegend noaxes;
   symbol1 interpol=join width=10 ci=cxC01C6E cv=cxA7398A
           font=swiss value=-;
run;
quit;
ods pdf close;

ods layout

Filename odsout ‘c:\’;
title2"Absolute layout";
ods pdf body=”Absolute.pdf" ;
ods layout Start width=10in height=8in ;
ods region x=0 y=0 width=40% height=40%;
proc gplot data=test;
title2 'PLOT #1';
plot y*x /name="hany1" noframe;
run;
ods region x=50% y=0 width=40% height=40%;
title2 'PLOT #2';
plot y*x /name="hany2" noframe;
run;
ods region x=0 y=50% width=40% height=40%;
title2 'PLOT #3';
plot y*x / name="hany3" noframe;
run;
ods region x=50% Y=50% width=40% height=40%;
title2 'PLOT #4';
plot y*x / name="hany4" noframe;
run;
quit;
ods layout end;
ods pdf close;

 

抱歉!评论已关闭.