全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1604 2
2012-05-13
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.
二维码

扫码加我 拉你入群

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

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

全部回复
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
二维码

扫码加我 拉你入群

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

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

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.
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群