Dear all,
I'm doing a scatter plot (potassium levels in 2 distinct moments) with this code (which works fine):
twoway (lfitci Pre_Pot Post_Pot, ciplot(rarea)) (scatter Pre_Pot Post_Pot,c(. l) m(Oh) mc(black) msiz(small)) (line W W, lp(dash) lc(black)) if Sequence==0, ytitle(Potassium(mEq/L)) xtitle(Potassium(mEq/L)) legend(order(1 2)) legend(off) text(7.8 7 "Line 45°",size(vsmall) place(e)) text(5.1 6.8 "Lfit: y=2.10 +0.52x",size(vsmall) place(e)) text(4.9 7 "{&sigma}{superscript:2}=0.43",size(vsmall) place(e)) xlab(2(1)8) ylab(2(1)8) xmtick(##10) ymtick(##10) ysize(5.5) graphregion(fcolor(white))
and produce this graph:
Array
The dashed line (45°) was created just to add a reference to the reader using:
generate W=_n
replace W=. if W>8 | W<1.4
My problem is when I try do to the same graph for the group Sequence=1. Changing the conditional from 0 to 1 the dashed line disappears!
twoway (lfitci Pre_Pot Post_Pot, ciplot(rarea))(scatter Pre_Pot Post_Pot,c(. l) m(Oh) mc(black) msiz(small)) (line W W, lp(dash) lc(black)) if Sequence==1, ytitle(Potassium(mEq/L)) xtitle(Potassium(mEq/L)) legend(order(1 2)) legend(off) text(7.8 7 "Line 45°",size(vsmall) place(e)) text(5.1 6.8 "Lfit: y=2.35 +0.48x",size(vsmall) place(e)) text(4.9 7 "{&sigma}{superscript:2}=0.59",size(vsmall) place(e)) xlab(2(1)8) ylab(2(1)8) xmtick(##10) ymtick(##10) ysize(5.5) graphregion(fcolor(white))
Array
ps: Sequence is a binary variable where 0 the patient started in one dialysis modality (CAPD) whilst 1 the patient started in another dialysis modality (APD)
Regards
Thyago
Related Posts with Line disappears
How to change xtline graphHi All! I have plotted a xtline graph for few entities. The observations between these entities ran…
MeologitQuestion: Do you know what might be the problem, and why stata does not recognizes apples as 10 gro…
construct pairs.Dear All, For the following data, Code: * Example generated by -dataex-. To install: ssc install d…
Regarding fixed effectsHello, I am an absolute beginner trying to run regressions and correctly intepret these regressions…
Compare beta coefficients of different panel regressionsDear Statalist-Users, Thank you for taking me in. After many hours of research, also in this forum,…
Subscribe to:
Post Comments (Atom)
0 Response to Line disappears
Post a Comment