Announcement

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

  • Adjusting colour of CI's using coefplot

    Hello is there anyway I can change the colour of the smoothed confidence intervals? This is the code to produce this plot of coefficients. For example, if I want the colour to be a smoothed out orange instead of red. I am using the user written command coefplot from ssc. Thanks.

    Code:
    coefplot (M, label(A)) (F, label(B)) , drop(_cons) cismooth grid(none)  keep(*gencells)  xline(0) groups(?.gencells = "{bf:Cells}")
    Click image for larger version

Name:	Cell.png
Views:	1
Size:	43.1 KB
ID:	1648842


  • #2
    Reproducible example?

    Comment


    • #3
      Hi Andrew, please see below an example of my dataset and code used to produce graph:


      Code:
      destring ID, replace
      xtset ID year
      xtreg lr i.gencells [pw= panel_ind_wt_1_2] if sex==1, fe
      estimates store M
      xtreg lr i.gencells [pw= panel_ind_wt_1_2] if sex==2, fe
      estimates store F
      coefplot (M, label(A)) (F, label(B)) , drop(_cons) cismooth grid(none)  keep(*gencells)  xline(0) groups(?.gencells = "{bf:Cells}")


      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input double ID float lr byte year long gencells
      10504000000002   -.3186359 1 2
      10504000000002  -3.1873674 2 2
      10504000000043  -2.4036455 1 1
      10504000000043    2.613899 2 2
      10504000000113    1.234423 1 3
      10504000000113   .25891808 2 2
      10504000000231   -2.949189 1 1
      10504000000231    1.567996 2 3
      10504000000444    .9008501 1 2
      10504000000444    .8814207 2 2
      10504000000482    2.613899 1 3
      10504000000482   1.4012096 2 3
      10504000000535  -1.0241696 1 1
      10504000000535   -2.236859 2 1
      10504000000644   2.4471126 1 1
      10504000000644   1.9467533 2 2
      10504000000696    -2.92976 1 2
      10504000000696   -3.449549 2 1
      10504000000748    1.567996 1 2
      10504000000748   -1.370393 2 2
      10504000000821   1.4012096 1 2
      10504000000821   1.0676366 2 1
      10504000000978   -2.419119 1 1
      10504000000978    .3553065 2 3
      10504000000991   1.4012096 1 3
      10504000000991  -1.0390252 2 1
      10504000001036    2.613899 1 3
      10504000001036   1.3244863 2 3
      10504000001052   .52209294 1 2
      10504000001052   -3.449549 2 2
      10504000001073   1.4012096 1 3
      10504000001073  -1.5697132 2 2
      10504000001102   .18347497 1 3
      10504000001102   -2.236859 2 3
      10504000001142   -2.236859 1 2
      10504000001142    2.613899 2 3
      10504000001236   -2.402652 1 2
      10504000001236   -1.563859 2 3
      10504000001239   1.9467533 1 1
      10504000001239  -.03875893 2 1
      10504000001244      .18852 1 2
      10504000001244   -.8573831 2 3
      10504000001261    2.613899 1 3
      10504000001261    2.613899 2 3
      10504000001304   1.4012096 1 3
      10504000001304   1.4012096 2 3
      10504000001470   -3.449549 1 1
      10504000001470   -3.191941 2 1
      10504000001471  -2.4997985 1 1
      10504000001471   -.5364607 2 1
      10504000001499 -.005772657 1 2
      10504000001499   -2.236859 2 2
      10504000001510   -3.282762 1 1
      10504000001510   -3.449549 2 1
      10504000001523  -1.0241696 1 1
      10504000001523   1.4012096 2 1
      10504000001624   -1.832888 1 2
      10504000001624   -3.449549 2 3
      10504000001632   1.4012096 1 1
      10504000001632   -2.236859 2 1
      10504000001704   1.4012096 1 3
      10504000001704    2.613899 2 2
      10504000001779  -1.5697132 1 2
      10504000001779  -1.7364997 2 1
      10504000001832    1.567996 1 3
      10504000001832   2.4471126 2 2
      10504000001834   -.9287747 1 3
      10504000001834   1.9467533 2 2
      10504000001909    .3553065 1 1
      10504000001909   -2.236859 2 2
      10504000001915  -2.4036455 1 2
      10504000001915   -.3366007 2 2
      10504000001932   -2.615616 1 1
      10504000001932   -3.449549 2 1
      10504000001943    1.831171 1 2
      10504000001943   2.3509598 2 3
      10504000001966  -.52381015 1 2
      10504000001966   -2.236859 2 1
      10504000001968  -1.0241696 1 2
      10504000001968   -.5364607 2 1
      10504000002069    .4461275 1 2
      10504000002069   .18243033 2 2
      10504000002139   1.9318976 1 2
      10504000002139   -3.449549 2 3
      10504000002297   -2.615616 1 2
      10504000002297   -3.449549 2 2
      10504000002304  -1.7364997 1 2
      10504000002304   1.4012096 2 3
      10504000002326   -3.449549 1 2
      10504000002326    2.613899 2 2
      10504000002390   -1.190956 1 2
      10504000002390  -1.0387385 2 1
      10504000002476    .7814519 1 2
      10504000002476   -3.449549 2 2
      10504000002694    2.613899 1 2
      10504000002694  -1.3275787 2 1
      10504000002727   -1.190956 1 2
      10504000002727   -3.282762 2 1
      10504000002766   -1.454131 1 2
      10504000002766   1.4012096 2 3
      end
      label values year wave
      label def wave 1 "Wave 1", modify
      label def wave 2 "Wave 2", modify
      label values gencells foodc
      label def foodc 1 "Gen/3", modify
      label def foodc 2 "Gen/1", modify
      label def foodc 3 "Gen/2", modify

      Comment


      • #4
        Your data example lacks some variables, but a slight modification still produces some plots. The colors need to be specified within -cismooth()-. The marker colors if needed to match the smoothed CIs need to be modified in the usual way.

        Code:
        destring ID, replace
        xtset ID year
        xtreg lr i.gencells in 1/50, fe
        estimates store M
        xtreg lr i.gencells in 51/100, fe
        estimates store F
        set scheme s1color
        coefplot (M, label(A) cismooth(color(navy))) (F, label(B) cismooth(color(orange))) , drop(_cons)   grid(none)  keep(*gencells)  xline(0) groups(?.gencells = "{bf:Cells}")
        Click image for larger version

Name:	Graph.png
Views:	1
Size:	29.7 KB
ID:	1649039

        Comment


        • #5
          Much appreciated Andrew, exactly what I needed.

          Comment

          Working...
          X