Announcement

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

  • Change the colors of markers in marginsplot

    Hi everybody

    Is it still not possible to directly change the colors of markers in marginsplot (see "Initially, the marginsplot looks as follows where we are unable to specify more than one color for the markers")?

    I have the following data and would like to change the colors of the markers in marginsplot, so they are different when gender is 0 and 1. My real data is confidential, so I have made up some data.

    Code:
    reg educational_attainment gender
    margins, at(gender = (0 1))
    marginsplot, recast(scatter)
    The two colors of interest are​​​​​: plotopts(mcolor("255 80 80")) and plotopts(mcolor("65 50 130"))

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float time_new byte educational_attainment float(gender finished_high_school)
     5 1 0 2011
     7 1 1 2010
     9 1 0 2010
     5 1 1 2011
    10 1 0 2010
     9 1 0 2010
     3 1 0 2011
     5 1 0 2010
     6 1 1 2010
     1 1 1 2011
     7 1 1 2010
     9 1 1 2011
     6 1 0 2011
     9 1 0 2010
     7 1 0 2010
    10 1 1 2010
     9 1 1 2011
     8 1 1 2011
     6 1 0 2010
     9 1 0 2011
     5 1 0 2011
     6 1 0 2011
     9 1 1 2011
     9 1 0 2010
     7 1 0 2011
    10 1 0 2010
     6 1 1 2011
    10 1 1 2010
     7 1 1 2011
     4 1 0 2011
     7 1 1 2010
     6 1 1 2011
     7 1 0 2010
     6 1 0 2011
     5 1 0 2011
     5 1 1 2010
     9 1 0 2011
     9 1 1 2010
     7 1 0 2011
     9 1 1 2011
     6 1 1 2010
     7 1 1 2010
     9 1 1 2011
     9 1 0 2010
     9 1 0 2011
     9 1 1 2010
     7 1 1 2010
     5 1 1 2011
     6 1 1 2011
     9 1 1 2010
     6 1 0 2010
     9 1 1 2011
     9 1 0 2011
     6 1 0 2010
     5 1 1 2011
     9 1 0 2010
     2 1 0 2010
     7 1 1 2011
     7 1 1 2011
     7 1 1 2010
     5 1 1 2011
     6 1 1 2010
     2 1 0 2010
    10 1 0 2010
     6 1 0 2010
     7 1 0 2010
     5 1 0 2010
     7 1 1 2010
     9 1 0 2010
     8 1 1 2011
     6 1 0 2011
     4 1 0 2010
     5 1 0 2010
     7 1 0 2011
     5 1 1 2010
     9 1 0 2011
     9 1 0 2011
     9 1 0 2011
     5 1 0 2011
     5 1 0 2010
     6 1 1 2010
     9 1 0 2011
     6 1 0 2010
     9 1 0 2011
     6 1 0 2010
    10 1 1 2010
     5 1 1 2011
     5 1 0 2011
     5 1 0 2010
     9 1 0 2011
     6 1 1 2010
     7 1 0 2010
     9 1 1 2011
     9 0 0 2011
     9 0 1 2011
     9 0 0 2011
     9 0 0 2011
     9 0 0 2011
    10 0 1 2010
    10 0 0 2010
     9 0 0 2011
     9 0 0 2011
    10 0 0 2010
     9 0 1 2011
     9 0 0 2011
    10 0 0 2010
     9 0 0 2011
    10 0 1 2010
    10 0 1 2010
     9 0 1 2011
    10 0 1 2010
    10 0 0 2010
     9 0 1 2011
     9 0 0 2011
     9 0 1 2011
    10 0 0 2010
    10 0 1 2010
     9 0 0 2011
     9 0 1 2011
    10 0 0 2010
    10 0 1 2010
    10 0 0 2010
     9 0 1 2011
     9 0 1 2011
     9 0 0 2011
     9 0 1 2011
    10 0 0 2010
     9 0 0 2011
    10 0 0 2010
     9 0 0 2011
     9 0 1 2011
     9 0 1 2011
     9 0 0 2011
    10 0 1 2010
    10 0 1 2010
    10 0 1 2010
    10 0 0 2010
    10 0 0 2010
    10 0 0 2010
    10 0 0 2010
    10 0 1 2010
    10 0 0 2010
    10 0 1 2010
    10 0 0 2010
    10 0 1 2010
     9 0 1 2011
     9 0 1 2011
    10 0 1 2010
     9 0 0 2011
    10 0 1 2010
    10 0 0 2010
    10 0 1 2010
    10 0 0 2010
    10 0 1 2010
     9 0 0 2011
    10 0 1 2010
     9 0 0 2011
     9 0 0 2011
     9 0 1 2011
     9 0 0 2011
     9 0 0 2011
     9 0 1 2011
    10 0 0 2010
    10 0 0 2010
    10 0 0 2010
     9 0 1 2011
    10 0 0 2010
    10 0 1 2010
    10 0 1 2010
     9 0 1 2011
    10 0 1 2010
     9 0 0 2011
    10 0 1 2010
    10 0 0 2010
     9 0 0 2011
    10 0 0 2010
     9 0 0 2011
     9 0 1 2011
     9 0 0 2011
    10 0 1 2010
     9 0 0 2011
    10 0 1 2010
     9 0 0 2011
     9 0 0 2011
    10 0 1 2010
    end

  • #2
    Code:
    reg educational_attainment gender
    margins, at(gender = (0 1))
    marginsplot, recast(scatter) plotdimension(gender) xdimension(gender) plot1opts(mc(red)) plot2opts(mc(blue))

    Comment


    • #3
      Thank you very much Andrew!

      Comment


      • #4
        Hi everyone, I am salina siddiqua, doing PhD in health economics at the university of York, UK. I am applying synthetic control method in my first chapter, I applied synth package from Hainmueller webpage but struggling to run placebo test and sensitivity analysis. Can anyone help me please with Abadie's code or your one so that I can develop code for my dataset. Thank you.

        Comment

        Working...
        X