Announcement

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

  • weighted scatterpolt with different colors

    Hi everybody,

    I am trying to create a weighted scatterplot with 3 different colors for 3 different groups of observations by using [aw=weights], but it seems that stata calculates weights separately for each group so the graph looks far different from the "uncolored" weighted one... the syntax I am using is the following:

    twoway (scatter d_91_10 med_wage [aw=occ_share_91], mlstyle(vthick) msize(small) mcolor (none)), legend(off) saving (occ1.gph)
    twoway (scatter d_91_10 med_wage if manual==1 [aw=occ_share_91], mlstyle(vthick) mlcolor(green) mcolor(none)) || (scatter d_91_10 med_wage if rout==1 [aw=occ_share_91], mlstyle(vthick) mlcolor(red) mcolor(none)) || (scatter d_91_10 med_wage if cognitive==1 [aw=occ_share_91], mlstyle(vthick) mlcolor(navy) mcolor(none)) , legend(off) saving(occ2.gph)
    gr combine occ1.gph occ2.gph, xcommon rows(2) iscale(1) ysize(13) xsize(10)

    Does anybody have any suggestion about how to solve this problem?

    Best,

    Valerio

  • #2
    I think the way to do this is plot three variables at once on the y axis, not one variable on three graphs superimposed. separate may help.

    Comment


    • #3
      Thank you very much Nick, now it works =)

      Comment

      Working...
      X