Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making one line thicker than others in graph?

    Hi!

    One more question. How do I make one line thicker in a graph? I want the line for the fully adjusted model (number 2, red) to be thicker than the rest. Can I also manually change color of the lines?

    regress HGB Total_CO2 if(SEX==0), robust
    local betahat1= `:di %5.3f _b[Total_CO2]'
    quietly eststo crude: margins, at(Total_CO2=(0(1)10)) post

    regress HGB Total_CO2 AGE DATUM i.SEASON if(SEX==0), robust
    local betahat2= `:di %5.3f _b[Total_CO2]'
    quietly eststo full: margins, at(Total_CO2=(0(1)10)) post

    regress HGB Total_CO2 AGE DATUM i.SEASON if(SEX==0 & HT115==0), robust
    local betahat3= `:di %5.3f _b[Total_CO2]'
    quietly eststo dietchange: margins, at(Total_CO2=(0(1)10)) post

    regress HGB Total_CO2 AGE DATUM i.SEASON if(SEX==0 & ENER_RAP_ADEQUATE==1), robust
    local betahat4= `:di %5.3f _b[Total_CO2]'
    quietly eststo misreporters: margins, at(Total_CO2=(0(1)10)) post

    coefplot crude full dietchange misreporters, at title(Haemoglobin (women)) ytitle(Haemoglobin) xtitle(CO{sub:2} (kg/day)) leg(order(1 "Crude model (B{sub:1}=`betahat1')"2 "Fully adjusted model (B{sub:2}=`betahat2') "3 "Excluding recent diet changers (B{sub:3}=`betahat3')"4 "Excluding potential mis-reporters (B{sub:4}=`betahat4')") pos(6)) recast(line) noci

    Click image for larger version

Name:	lines.jpg
Views:	1
Size:	41.9 KB
ID:	1734918

  • #2
    Hopefully this example will give you the basic idea.The *4 makes the red line's linewidth four times as thick as the default. The *1 makes the other linewidths equal to the default.
    Code:
    cap preserve
    cap drop _all
    
    set obs 50
    set seed 2345
    gen x=runiform()
    forval j=1/4 {
     gen y`j'=runiform()
     qui reg y`j' x
     qui predict py`j'
    }
    
    tw scatter py* x, s(i .. ) c(l .. ) lco(blue red green yellow) lpat(solid ..) lwidth(*1 *4 *1 *1)
    
    cap restore

    Comment

    Working...
    X