stata作图技巧

标签:
杂谈 |
Pharmacological treatments | Urban | Rural | ||
Intervention | Control | Intervention | Control | |
Calcium
antagonists |
5.9 | -12.3 | 17.5 | -0.3 |
Combination | -2.4 | 9.2 | 1.3 | -6.7 |
ACEI/ARB | -2.1 | -1.7 | 2.9 | -1.6 |
Diuretics | 4.9 | 3.1 | 2.2 | -0.6 |
B-blocker | 4 | -9.4 | 2.9 | 3 |
Single-drug therapy | -12.7 | 9.3 | -18.3 | 6.2 |
2-drug combination therapy | 16.7 | -9.5 | 15.4 | -1.2 |
3-drug combination therapy | -4.1 | 0.2 | 2.9 | -5 |
先用stata将数据整理如下:
treatments | region | intervention | change |
Calcium
antagonists |
urban | 1 | 5.9 |
Combination | urban | 1 | -2.4 |
ACEI/ARB | urban | 1 | -2.1 |
Diuretics | urban | 1 | 4.9 |
B-blocker | urban | 1 | 4 |
Single-drug therapy | urban | 1 | -12.7 |
2-drug combination therapy | urban | 1 | 16.7 |
3-drug combination therapy | urban | 1 | -4.1 |
Calcium
antagonists |
urban | 2 | -12.3 |
Combination | urban | 2 | 9.2 |
ACEI/ARB | urban | 2 | -1.7 |
………… |
在do-file editor(等同于spss、sas的语法窗口)里面输入命令:
graph hbar (asis)
得到最原始的图形:
http://home.epiman.cn/data/attachment/album/201102/23/0829146kpnomjzowss66jl.png
打开图片生成窗口,点击file-start graph editor,然后每双击一处,都会出现相应的编辑窗口,如点击上图最左边的部分,出现如下窗口,
http://home.epiman.cn/data/attachment/album/201102/23/082914illsll3ly0a7h3zl.jpg
然后根据自己需要修饰上述图形,最终得到我想要的自己的图形:
http://home.epiman.cn/data/attachment/album/201102/23/082913yrh1jmjwomit6itr.jpg
附:stata作图命令graph
gra
图形类型
histogram /* 直方图
oneway /* 一维散点图
twoway /* 二维散点图、线图
matrix /* 二维散点图阵
bar
hbar
pie
box
star
over:分组
gap(5):组内条图的间距为5,-5的话就是重叠5各像素
legend:设置图例格式,row(1)就是设置图例的摆放为一排,如果row(2)就是intervention和control各占一排,就是最终图形中图例的显示格式啦,label就是给图例的数字添加标签
上组命令中的其他句法应该没什么问题啦,^_^