Announcement

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

  • Making a creative graph

    Hey Hey,

    I am going to plot this graph. As you can see the lines are not distinguishable. Are there any statistics who is professional in colors? I need to change the colors of this graph in a more clear way.

    variables: i. shr_immg
    ii. expgr
    iii. year
    iv. sk_rat


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(shr_immg expgr year) byte sk_rat
     .05503061  2.5 2010 1
     .06694431  2.5 2010 2
     .05063058  2.5 2010 3
    .019168485  2.5 2010 4
     .06142874  7.5 2010 1
     .06934506  7.5 2010 2
     .04832072  7.5 2010 3
     .01989755  7.5 2010 4
     .08093745 12.5 2010 1
     .07400702 12.5 2010 2
     .04825509 12.5 2010 3
    .020215943 12.5 2010 4
     .08118037 17.5 2010 1
    .065791704 17.5 2010 2
     .04412679 17.5 2010 3
     .02139619 17.5 2010 4
     .07085426 22.5 2010 1
     .05895051 22.5 2010 2
     .03882817 22.5 2010 3
     .02112953 22.5 2010 4
     .05903677 27.5 2010 1
      .0457269 27.5 2010 2
    .028109454 27.5 2010 3
    .017869443 27.5 2010 4
     .05306067 32.5 2010 1
     .03250171 32.5 2010 2
    .019051975 32.5 2010 3
    .015390552 32.5 2010 4
     .03923188 37.5 2010 1
     .02492431 37.5 2010 2
    .016793575 37.5 2010 3
    .011034894 37.5 2010 4
     .04691476  2.5 2011 1
      .0635872  2.5 2011 2
     .04785227  2.5 2011 3
    .021027865  2.5 2011 4
     .05538343  7.5 2011 1
    .070339486  7.5 2011 2
     .04933658  7.5 2011 3
    .020823166  7.5 2011 4
      .0666237 12.5 2011 1
     .07248996 12.5 2011 2
     .04630022 12.5 2011 3
     .02159231 12.5 2011 4
     .07227072 17.5 2011 1
    .067834616 17.5 2011 2
     .04430788 17.5 2011 3
     .02158496 17.5 2011 4
     .06433461 22.5 2011 1
      .0567777 22.5 2011 2
     .03798372 22.5 2011 3
     .02393508 22.5 2011 4
     .05270181 27.5 2011 1
     .04593248 27.5 2011 2
    .029678874 27.5 2011 3
      .0204106 27.5 2011 4
     .04756397 32.5 2011 1
     .03298021 32.5 2011 2
     .01988868 32.5 2011 3
      .0165327 32.5 2011 4
      .0363319 37.5 2011 1
    .025909504 37.5 2011 2
    .015751133 37.5 2011 3
    .013578624 37.5 2011 4
     .03847504  2.5 2012 1
     .05529667  2.5 2012 2
     .04445817  2.5 2012 3
     .02226549  2.5 2012 4
     .04930587  7.5 2012 1
     .06545868  7.5 2012 2
     .04206071  7.5 2012 3
     .02101392  7.5 2012 4
     .05395012 12.5 2012 1
     .06328956 12.5 2012 2
     .04206284 12.5 2012 3
     .01884999 12.5 2012 4
     .05991699 17.5 2012 1
     .06275273 17.5 2012 2
     .03902856 17.5 2012 3
    .021033356 17.5 2012 4
     .05644323 22.5 2012 1
     .05213553 22.5 2012 2
    .033387184 22.5 2012 3
     .02176094 22.5 2012 4
     .04528735 27.5 2012 1
     .04316704 27.5 2012 2
     .02735599 27.5 2012 3
     .02016751 27.5 2012 4
     .04004281 32.5 2012 1
    .030530445 32.5 2012 2
     .02156375 32.5 2012 3
    .015440163 32.5 2012 4
    .032650497 37.5 2012 1
     .02599809 37.5 2012 2
     .01348382 37.5 2012 3
     .01402306 37.5 2012 4
    .036287617  2.5 2013 1
     .05437677  2.5 2013 2
     .04160819  2.5 2013 3
     .02573657  2.5 2013 4
    end
    
    twoway (line shr_immg expgr if year==2010 & sk_rat==1, lcolor(gs10)) ///
    (line shr_immg expgr if year==2011 & sk_rat==1, lcolor(black) lpat(dash_3dot)) ///
    (line shr_immg expgr if year==2012 & sk_rat==1, lcolor(gs7) lpat(vshortdash)) /// 
    (line shr_immg expgr if year==2013 & sk_rat==1, lcolor(black) lpat(dot)) ///
    (line shr_immg expgr if year==2014 & sk_rat==1, lcolor(black) lpat(dash)) ///
    (line shr_immg expgr if year==2015 & sk_rat==1, lcolor(black) lpat(solid)) ///
    (line shr_immg expgr if year==2016 & sk_rat==1, lcolor(black) lpat(vshortdash)) ///
    (line shr_immg expgr if year==2017 & sk_rat==1, lcolor(black) lpat(solid)) ///
    (line shr_immg expgr if year==2018 & sk_rat==1, lcolor(black) lpat(vshortdash)) ///
    (line shr_immg expgr if year==2019 & sk_rat==1, lcolor(gs10) lpat(dash)),legend(label(1 "2010") ///
    label(2 "2011") label(3 "2012") label(4 "2013") label(5 "2014") label(6 "2015") label(7 "2016")label(8 "2017")label(9 "2018")label(10 "2019")cols(10)) ylab(,nogrid) ///
    ti("Panel A: 1st Quartile", size(medium) color(black)) xti("Years of Experience", size(medium)) ///
    yti("Immigrant Share") graphr(ic(white) ifc(white) ilc(white) fcolor(white) lcolor(white)) ///
    saving(Quartile1_Fig1.gph)
    Click image for larger version

Name:	graph.1.PNG
Views:	1
Size:	71.8 KB
ID:	1700815
    Thank you.


    Cheers,
    Paris

  • #2
    Look at fabplot from the Stata Journal.

    Code:
    findit fabplot
    Code:
    set scheme s1color
    fabplot line shr_immg expgr if sk_rat==1, by(year)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	44.4 KB
ID:	1700820

    Comment


    • #3
      Andrew, Thank you for getting back to me.
      Actually, I need to plot them in one plot (all together).

      Comment


      • #4
        Some possibilities are discussed at https://journals.sagepub.com/doi/ful...36867X19893641.

        Comment

        Working...
        X