我在stata中使用coefplot来绘制系数。我将两个图组合在一起,并希望使用不同的xscale。该网页建议使用此选项:
byopts(xrescale)
但是,此选项不允许用户指定的xscale。例如,我想用xscale(-0.1,0.5)指定一个子图,用xscale(-0.1,0.1)指定另一个子图。以下代码无法实现我的目标。
coefplot (est1,label(Grade 5)) (est2,label(Grade 6)) ///
, bylabel("Chinese") xscale(r(-0.1,0.5)) || ///
(est3,label(Grade 5)) (est4,label(Grade 6)) ///
,bylabel("Math") xscale(r(-0.1,0.1)) ||, ///
keep(1.female) ///
yscale(off) graphregion(fcolor(white)) xscale(r(0,1)
titleg(0.1)) ///
xline(0, lwidth(vthin) lcolor(red)) ciopts(recast(rcap))
byopts(xrescale)
答案 0 :(得分:1)
由于我们没有您的数据,完整或有效的代码,甚至没有达到目标的实际图表,因此很难知道出了什么问题。
这是可重现的示例,显示每个子图中的自定义x轴范围:
sysuse auto, clear
eststo m1: reg price c.mpg
eststo m2: reg price c.weight
eststo m3: reg price i.foreign
coefplot (m1, xscale(range(-350 -50))) || (m2, xscale(range(1 3))) || (m3, xscale(range(-1200 2000))) ///
, drop(_cons) byopts(xrescale cols(3))
图表如下所示:
可能的诊断:
coefplot
可能无法收听。没有看到模型输出就无法判断。coefplot
的最新版本,这是已修复的内容。使用用户编写的命令,当遇到问题时,总是值得检查。