楼主: 若水烟寒
3749 11

[问答] 如何使多副图在一副图中显示? [推广有奖]

  • 3关注
  • 9粉丝

已卖:840份资源

博士生

8%

还不是VIP/贵宾

-

威望
0
论坛币
1391 个
通用积分
33.0863
学术水平
14 点
热心指数
18 点
信用等级
12 点
经验
2716 点
帖子
183
精华
0
在线时间
176 小时
注册时间
2011-5-11
最后登录
2025-6-4

楼主
若水烟寒 发表于 2012-12-7 20:04:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
想问一下可不可以在一幅图中同时显示4个图呢?不是sgpanel的命令,而是用sgscatter之类的作图之后想让它们在一副图中显示,谢谢~



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Scatter Panel SCAT pane GPA 如何

沙发
ziyenano 发表于 2012-12-7 21:29:31
data ex;
do x=1 to 4;
y=2*x;
output;
end;
run;

ods graphics on /reset=all;
ods html path="E:\" body="b.htm";
ods layout Start width=10in height=8in columns=2 rows=2
column_gutter=.5in row_gutter=.8in row_heights=(3.5in 3.5in);;
ods region row=1 column=1  ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=1 column=2 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=2 column=1 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
ods region row=2 column=2 ;
proc sgplot data=ex;
scatter x=x y=y;
run;
run;
ods layout end;
ods html close;
quit;
已有 3 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
admin_kefu + 100 热心帮助其他会员
webgu + 1 + 1 + 1 精彩帖子
若水烟寒 + 1 + 1 + 1 热心帮助其他会员

总评分: 论坛币 + 100  学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

藤椅
若水烟寒 发表于 2012-12-7 21:42:03
ziyenano 发表于 2012-12-7 21:29
data ex;
do x=1 to 4;
y=2*x;
谢谢~

板凳
webgu 发表于 2012-12-8 11:41:44
另一种方法,例子:

/* Data preparation*/
data sasuser.class (drop=name );
length Gender $ 6;
set sashelp.class;
if sex="F" then Gender="Female";
else Gender="Male";
run;
proc sort data=sasuser.class out=sasuser.class;
by weight height;
run;
/* global setting*/
goptions reset=all hsize=2.75in vsize=2.06in;
ods html close;
ods listing;
axis1 label=none style=0 major=none value=none;
axis2 label=("Age");

axis3 label=("Height") order=50 to 75 by 5;
axis4 label=("Weight") order=50 to 150 by 25 minor=(n=1);
legend1 label=none value=("Male" "Female") Position=(right middle outside)
across=1;
legend2 label=none value=("Male" "Female");
symbol i=join;
/*draw chart or plot*/
proc gchart data=sasuser.class gout=sasuser.excat;
vbar age/discrete hminor=0 subgroup=gender
inside=freq raxis=axis1 maxis=axis2
noframe legend=legend1;
run;
hbar age/ discrete sumvar=height mean
meanlabel="Avg.Height" vminor=0
raxis=axis1 maxis=axis2;
run;
pie gender/ noheading legend=legend1 percent=inside;
run;
proc gplot data=sasuser.class gout=sasuser.excat;
plot height*weight=gender/ vminor=1 vaxis=axis3
haxis=axis4 legend=legend2;
run;
quit;
goptions reset=all hsize=5.5in vsize=4.12in;

/*put them together*/
proc greplay gout=sasuser.excat igout=sasuser.excat nofs
tc=sashelp.templt template=l2r2;
device win;
treplay 1:gchart 2:gchart1 3:gchart2 4:gplot;
quit;
ods listing close;
ods html;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
若水烟寒 + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

SAS资源
1. SAS 微信:StatsThinking
2. SAS QQ群:348941365

报纸
若水烟寒 发表于 2012-12-8 14:15:37
webgu 发表于 2012-12-8 11:41
另一种方法,例子:

/* Data preparation*/
学习了!!谢谢^^

地板
zhentao 发表于 2012-12-9 10:31:17
学习了。一直不善于用SAS做图,要努力了。

7
若水烟寒 发表于 2012-12-21 12:07:18
webgu 发表于 2012-12-8 11:41
另一种方法,例子:

/* Data preparation*/
今天看到一个更简单的做法:

ods graphics / imagename="regplot" imagefmt=png;
ods listing gpath="D:\***";
ods listing on;
proc template;
  define statgraph intro;
    begingraph;
      entrytitle "Simple 3x2 Lattice with Five Cells Populated";
       layout gridded / columns=3;
  
  /* stand-alone plot statements define cells 1-3 */
  boxplot x=sex y=age;
  boxplot x=sex y=height;
  boxplot x=sex y=weight;
  /* overlay blocks define cells 4-5 */
  layout overlay;
    scatterplot y=weight x=height;
    pbsplineplot y=weight x=height;
    entry halign=right "Spline" / valign=bottom;
  endlayout;
  layout overlay;
    scatterplot y=weight x=height;
    loessplot y=weight x=height;
    entry halign=right "Loess " / valign=bottom;
  endlayout;
        endlayout;
    endgraph;
  end;
run;
proc sgrender data=sashelp.class template=intro;
run;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
webgu + 1 + 1 + 1 观点有启发

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

8
若水烟寒 发表于 2012-12-21 12:08:12
ziyenano 发表于 2012-12-7 21:29
data ex;
do x=1 to 4;
y=2*x;
今天看到一个用proc template做得方法,在7楼~

9
若水烟寒 发表于 2012-12-21 12:09:18
ziyenano 发表于 2012-12-7 21:29
data ex;
do x=1 to 4;
y=2*x;
row_gutter后面的那个in好像总会报错……去掉就好了……

10
ziyenano 发表于 2012-12-21 12:47:05
若水烟寒 发表于 2012-12-21 12:08
今天看到一个用proc template做得方法,在7楼~
感谢分享!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 15:29