zhao1198的个人博客分享 http://blog.sciencenet.cn/u/zhao1198

博文

Stata作图_拼图

已有 6781 次阅读 2010-4-22 10:02 |个人分类:Stata|系统分类:博客资讯



问题如下:

group          t1       t2               t3       t4       t5
1 0.607629 0.319061 0.196555 0.159638 0.156538
2 0.644275 0.469192 0.402161 0.308563 0.273491
3 0.625802 0.51997 0.428098 0.410723 0.386954
4 0.758013 0.608988 0.500265 0.570338 0.367709
5 0.744472 0.653832 0.59159 0.521995 0.554327
6 0.75196 0.596777 0.548858 0.413378 0.471474
7 0.653286 0.567887 0.530312 0.352001 0.369351
8 0.768366 0.535249 0.378785 0.415009 0.493597
9 0.577552 0.361732 0.36978 0.42007 0.415018
10 0.443312 0.258684 0.194053 0.068198 0.160559

使用上面的数据,想要绘成每一个group一条线,横轴是时间,如t1t2t3t4t5;纵轴是数值。该怎样做?

 

第一种情况:

reshape long t,i(group) j(time)

twoway (line t time), by(group)

 

第二种情况:做到一张图上

clear
input group   t1  t2   t3   t4   t5
1  0.607629 0.319061 0.196555 0.159638 0.156538
2  0.644275 0.469192 0.402161 0.308563 0.273491
3  0.625802 0.519970 0.428098 0.410723 0.386954
4  0.758013 0.608988 0.500265 0.570338 0.367709
5  0.744472 0.653832 0.591590 0.521995 0.554327
6  0.751960 0.596777 0.548858 0.413378 0.471474
7  0.653286 0.567887 0.530312 0.352001 0.369351
8  0.768366 0.535249 0.378785 0.415009 0.493597
9  0.577552 0.361732 0.369780 0.420070 0.415018
10 0.443312 0.258684 0.194053 0.068198 0.160559
end
reshape long t,i(group) j(time)
xtset  group time
xtline t,overlay

 

Graph.jpg

 





https://wap.sciencenet.cn/blog-285749-314813.html

上一篇:每一个成功都是必然的—复旦经院宋铮老师的论文被《美国经济评论》作为封面重点论文推出
下一篇:Hausman-Taylor Approach
收藏 IP: .*| 热度|

0

评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-18 18:41

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部