楼主: purpleam
1625 2

[其他] How can I draw a scatter plot with subgroup of different markers in Stata? [推广有奖]

  • 0关注
  • 0粉丝

已卖:116份资源

本科生

64%

还不是VIP/贵宾

-

威望
0
论坛币
433 个
通用积分
1.0500
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
2240 点
帖子
70
精华
0
在线时间
86 小时
注册时间
2008-11-6
最后登录
2025-9-26

楼主
purpleam 发表于 2012-5-13 01:58:19 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
Hey everyone,
I met some difficulty in a scatter plot by STATA.


What command can be applied to get a scatter plot by subgroup with two different markers in a single graph?

For example, these two markers indicate subgroup 1 and 2.
Untitled.png
How can I acchieve this in Stata?
What command can be used?
Many thanks.
二维码

扫码加我 拉你入群

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

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

关键词:Different subgroup Scatter marker DIFFER difficulty different everyone indicate command

沙发
skatakmh 发表于 2012-5-13 06:36:11
Well, the easiest way is to create a dummy variable just for the subgroup (ie subgroup 1). Then with the help of the twoway scatter command you can have a graph like that in the picture.

          gen dummy=1 if subgroup==1
          replace dummy=0 if subgroup==2


After that
twoway  (scatter var1 var2 if dummy==1 , sort mcolor(blue) msize(small) msymbol(X) ) /*       
  */(scatter var1 var2 if dummy==0 , sort mcolor(red) msize(small) msymbol(triangle_hollow))

Try experimenting with the mcolor msize and msymbol values inside the brackets (i think that for your graphs msymbol has to be circle and circle_hollow respectively.

Hope this helps
已有 1 人评分论坛币 收起 理由
dxystata + 10 好的意见建议

总评分: 论坛币 + 10   查看全部评分

藤椅
purpleam 发表于 2012-5-13 08:06:42
skatakmh 发表于 2012-5-13 06:36
Well, the easiest way is to create a dummy variable just for the subgroup (ie subgroup 1). Then with ...
It works!
Many thanks.
Best regards.

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-20 14:45