楼主: zzwin1006
2520 5

[问答] SAS 单线散点图如何随机分布 [推广有奖]

  • 1关注
  • 1粉丝

已卖:89份资源

本科生

88%

还不是VIP/贵宾

-

威望
0
论坛币
2099 个
通用积分
0.1080
学术水平
2 点
热心指数
2 点
信用等级
2 点
经验
2417 点
帖子
30
精华
0
在线时间
181 小时
注册时间
2014-8-16
最后登录
2025-8-25

楼主
zzwin1006 发表于 2015-1-23 10:26:19 |AI写论文
10论坛币
  请教各位,如何用SAS实现R语言中画散点分布图,其中横轴为离散的变量,字符数字都行。SAS实现的是单线,而R实现的是随机散布

Rplot03.jpeg

最佳答案

jingju11 查看完整内容

Here is a complete sample code: JingJu
关键词:随机分布 散点图 R实现 如何用 R语言 散点图 分布图 如何

回帖推荐

jingju11 发表于2楼  查看完整内容

Here is a complete sample code: JingJu

沙发
jingju11 发表于 2015-1-23 10:26:20
Here is a complete sample code: JingJu

  1. data have;
  2.         call streaminit(1234);
  3.         do i =1 to 10000;
  4.                 y =abs(rand('normal',0,120));/*Folded Normal dist*/
  5.                 x =rand('poisson', 1.2);/*-------------discrete x*/
  6.                 output;
  7.         end;
  8. run;

  9. %let gap=0.20;
  10. data have2;
  11.         call streaminit(1234);
  12.         set have;
  13.         x0=x +(1-&gap)*(rand('uniform')-0.5);/*randomly assign values around x*/
  14. run;

  15. proc sgplot noautolegend;       
  16.         scatter x=x0 y=y/markerattrs=(symbol=circlefilled size =5);
  17.         xaxis grid values=(0 to 8 by 1) offsetmin=0.075 offsetmax=0.075 label='x';
  18.         yaxis grid;
  19. run;
复制代码

藤椅
fishsil 发表于 2015-1-23 14:47:44
问题看不太懂,不知道proc gplot是否可以解决 你的问题

板凳
zzwin1006 发表于 2015-1-25 15:10:28
fishsil 发表于 2015-1-23 14:47
问题看不太懂,不知道proc gplot是否可以解决 你的问题
proc gplot打出来的分布是在一条竖直线上,没有上面那种柱形分布的效果

报纸
jingju11 发表于 2015-1-26 12:45:51
Say, you want to have the gap = 20% width of the 'bar' for each discrete X value. JingJu
Here is an example:
  1. x0 =x +0.8*(ranuni(1)-0.5); /*transform X from discreate to continuous*/
复制代码
_1.PNG

地板
mycpcw 发表于 2015-1-26 23:35:53
学习了

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

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