Announcement

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

  • Format Colours CI Coefplot

    I am creating coefficient plots for different models next to each other, and I want to change the colour of the confidence intervals in each one of the models, but whatever I try it changes the colours of all plots. Here is a reproducible example:

    Code:
    sysuse auto, clear
    reg rep78 mpg
    estimate store reg1
    reg turn mpg
    estimate store reg2
    coefplot reg1, bylabel(Reg1) || reg2, bylabel(Reg2) ||, keep(mpg) xline(0, lpattern(dash)) nokey ciopts(lcolor("blue") recast(rcap)) color("blue") subtitle(, fcolor(white) margin(medium) lcolor(gs10) lwidth(thick)) byopts(rows(1) graphregion(color(white))) level(90)
    How do I change stata what specific colour I want for each of the two plots? For example how do I change the colour of the confidence intervals on the plot on the right to red?

    Thank you very much!

  • #2
    coefplot is from the Stata Journal/ SSC, as you are asked to explain (FAQ Advice #12). As in standard twoway-type graphs, you affect the rendition of a particular confidence interval using the syntax

    Code:
    ci#opt()
    where (#= 1, 2, ..., k), for a total of k plots.

    Comment


    • #3
      Thank you Andrew, however I tried using this option and Stata tells me "option ci1opt() not allowed", am I using it wrong?

      Comment


      • #4
        I think you want the option -norecycle-

        Code:
        set scheme s1color
        coefplot reg1, bylabel(Reg1) mc(blue) ciopt(lc(blue))|| reg2, bylabel(Reg2)  mc(red) ciopt(lc(red))||, keep(mpg) xline(0, lp(dash)) nokey norecycle
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	37.2 KB
ID:	1619995

        Comment


        • #5
          Now it works perfectly, thank you so much!

          Comment

          Working...
          X