Announcement

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

  • Combine: creates disastrous figure

    Dear all

    I am using the following code for the time series graph, and I am having some issues combining multiple graphs.

    The code produces a wonderful graph for publication exactly as I would like it if it were single, but when I attempt to combine the same graph for a number of plots, something disastrous is happening. Labels, overlaid on each other, anything you could imagine—I would like to combine 17 plots into the same figure. For time savings, I provide data for the first plot; just assume that this needs to be reproduced and combined all together. The code I use, and a data sample, are below. It is the same for the first subplot, repeated 17 times for the graph combination. The results I get are in this figure. As you can see, it is a totally unproductive graph. Note that I used the altshrink option to shrink labels without results.

    I would greatly appreciate it if you could be of any help on this.



    Best



    Mario




    Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	320.1 KB
ID:	1717694


    Best



    Mario




    Code:
     tsset year
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD1)
    
     
    
      
     
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD2)
    
     
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD3)
    
     
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD4)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD5)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD6)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD7)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD8)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD9)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD10)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD11)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD12)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD13)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD14)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD15)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD16)
    
      
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1) ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE") col(6) size(4) ring(0) pos(1) region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)  nodraw name(MOD17)
     
     
     
     
     graph combine MOD1 MOD2 MOD3 MOD4 MOD5 MOD6 MOD7 MOD8 MOD9 MOD10 MOD11 MOD12 MOD13 MOD14 MOD15 MOD16 MOD17, graphr(c(white))   title("WHATEVER EVER  TITLE FOR THE PLOT GOES HERE", size(medsmall)) altshrink

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(year pri gri pec gec lpr lp)
    1970 -.11020923   1.122472 -1.6690977    -.609033  .0019841194  .28916454
    1971 -.11784625 -1.4437325  -.6124067  -1.0307827    .01531744 -.18896055
    1972  -.7309446  -.9740481   .4134553   -.3323314     .0065732 -.08211374
    1973  -3.411802  -2.350223 -1.4371306   -.6980138   .001730442 -.17750692
    1974   .6505284   .6891103    1.58546   1.1790892   .032778263 -.05131817
    1975  -.5586438  1.0655098  -.6442625   -.1395919    .04823589  -.7042222
    1976  4.4099493   2.783047   1.224238    .7382225  -.023154736 -1.0049963
    1977  -.3375759   .3593845  .04653448   .40331775   -.02530527   .4274552
    1978   .1781428   .2449851  -.4878092   -.2399677    .01596117 -.01406598
    1979  1.0419207    .384033  1.2527897    .5596663  .0022716522 .036265373
    1980   .9817587  1.5234034   .4267486    .5921825   .014349937  -.3305197
    1981   .3842666 -.04288566  -.0588057  -.32790565    .04069948  -.5351281
    1982   .3166945 -.17985135   .7687415    .8153216  -.012685776  -.3424797
    1983   2.773745   2.571451   .9366226   1.1103046  -.005513668  .11159432
    1984   .8404977  .30912805   .9496725    .8827789   -.01543522 -.12059069
    1985    .723146   .8237398  .27580595   .59342194   .010739803   .3617719
    1986  2.2070675  1.6060398  1.0589557    .9092412   -.01013136    -.46076
    1987 -2.2916596 -1.3056936   -.185843  -.19152117  -.032797813  .27034593
    1988 -1.9010205 -2.7576854 -1.1911068   -1.388949   .009019375  -.3210269
    1989 -.52814835  -.7010194 -.15796614   -.2560501     .0247612  .29141963
    1990  -.6228927  -.1756656  .06518078   .09402847    .10807419  .13970327
    1991   .8834122   .6456485  -.4784899   -.3973651  -.012972832  -.7007768
    1992   3.177523  2.8696516  .45812654    .2824707  -.027316093  -.6049224
    1993   .9952512  -.6302409 -.34815645   -.6428354    .09747791 -.14088756
    1994 -1.6830876  -.7722335  -.1210618    .3095286   -.05698776   .3404654
    1995   .5467298  .59251714  .10209417    .4382772   -.08039331   .7159832
    1996  2.0610332  2.3005147  -.3310671   .22561646   -.06083012   .7285892
    1997 -2.2396195  -1.313446    .485805  -.04075527  -.007090092 .022037745
    1998 -.04266119  .59297943  .17318916   .11773682   .034263134   .2918048
    1999  -.7705345  -.5972691   .2707138    .3060293  -.065504074  -.3378398
    2000 -.24594712  -1.568033   .1075697   -.4287343  -.018335342 -.16774917
    2001 -1.9787233 -.02099192  -.4617829  -.18886852   .009590626  .51992583
    2002   .6309826  .27881455  .18304157   -.3131309  -.003203869  -.2383342
    2003   .1474272 -1.0245726 -1.4184122   -.6845551  -.009723663  .21169543
    2004  .28387487  -.4557884  -.1893649 .0006072521  -.008559704   .1674969
    2005 -2.1152122 -1.3046148   .7638936     .437777 -.0017728806  .22368503
    2006  -2.541169 -2.1889184  -.4475203   -.3767607  .0019965172 -.13569331
    2007  1.2422656  1.1198527 -.04471898   -.1028788   .002766609 -.05322909
    2008 -.28497553 -2.1104822 -.16419554   -.8259983  .0022859573 .026313305
    2009  1.0710404   2.011527  -.8857934   -.7744827   .025505066  -1.139676
    end
    ------------------ copy up to and including the previous line ------------------





  • #2
    Mario,

    When I plot just the first graph of your 17, I don't see something wonderful. Maybe it's my mistake. The keys and legends overlap in a long unreadable line at the top. Try the code below. It may not be exactly what you want, but it's readable.

    Code:
      twoway (tsline lp, lpattern(solid) lcolor(navy) lw(medthick) yaxis(1)  ytitle("WHATEVER EVER GOES HERE", axis(1))) (tsline  lpr, lpattern(dash) lcolor(black) lw(medthick yaxis(1))) (tsline pri,lpattern(dash_dot) yaxis(2) ) (tsline gri, lpattern(shortdash) yaxis(2) ) (tsline pec ,lpattern(longdash) yaxis(2)) (tsline gec , lpattern(dash_dot_dot) yaxis(2) ytitle("WHATEVER EVER GOES HERE" , axis(2)) ) if inrange(year,1970,2010) , graphr(c(white)) ///
     legend(order(1 "Growth rate of labor productivity" 2 "WHATEVER EVER LONG LONG TITLE GOES HERE" 3 "WHATEVER EVER GOES HERE" 4 "WHATEVER EVER GOES HERE" 5 "WHATEVER EVER GOES HERE" 6 "WHATEVER EVER GOES HERE")  size(4) ring(0) pos(1)  region(lcolor(none))) ///
     title("WHATEVER EVER GOES HERE", size(medsmall)) xsize(4) ysize(1)  xlabel(1970(5)2010)
    I just copied the your code for the first graph and removed the col(6) just before size(4) ring(0) (as well as the nodraw and name.)

    It might be easier to figure out what's happening if your long legends amd titles were not all so similar, if not identical. It would also help if you used more line breaks to make the code itself more readable.
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment


    • #3
      Why be surprised at the result? graph combine tries to do exactly what you say.

      Some graphs can stand reduction in size, but not yours. Each individual graph already has absurdly long titles. I agree with Devra Golbe

      There is no intelligence inside graph combine to act as a graph editor and remove repeated information, still less to make design choices to improve on your code. Shrinking text is useless if the text becomes unreadable.

      Further, there isn't a way to rescue your design, assuming that what you really want is 17 graphs all broadly like the first. .

      I am not an economist, but your data look like economic data and perhaps the problem you're moving towards is something like showing graphs for most or all of the regions of Italy. If so, the graph that work best may possibly be a 2 x 2 composite that shows about 4 or 5 regions in each panel, with direct labelling.

      On the spaghetti problem, see for example

      SJ-21-2 gr0087 . . Front-and-back plots to ease spaghetti and paella problems
      (help fabplot if installed) . . . . . . . . . . . . . . . . N. J. Cox
      Q2/21 SJ 21(2):539--554
      explores front-and-back plots, in which each subset of data
      is shown separately with the other subsets as backdrop

      https://journals.sagepub.com/doi/pdf...6867X211025838

      SJ-19-4 gr0080 . . . . . . Some simple devices to ease the spaghetti problem
      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
      Q4/19 SJ 19(4):989--1008 (no commands)
      gives guidance on avoiding the spaghetti problem in graphics
      (where multiple time series or other functional traces show
      mostly a tangled mess)

      https://journals.sagepub.com/doi/pdf...36867X19893641

      In case it helps, here is a way to plot your data example. See also

      SJ-20-4 gr0085 . The by() option of graph can work better than graph combine
      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
      4/20 SJ 20(4):1016--1027 (no commands)
      describes whether to use the by() option of graph or
      graph combine for paneled figures

      https://journals.sagepub.com/doi/pdf...36867X20976341

      There is scope for longer and more informative subtitles.

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input float(year pri gri pec gec lpr lp)
      1970 -.11020923   1.122472 -1.6690977    -.609033  .0019841194  .28916454
      1971 -.11784625 -1.4437325  -.6124067  -1.0307827    .01531744 -.18896055
      1972  -.7309446  -.9740481   .4134553   -.3323314     .0065732 -.08211374
      1973  -3.411802  -2.350223 -1.4371306   -.6980138   .001730442 -.17750692
      1974   .6505284   .6891103    1.58546   1.1790892   .032778263 -.05131817
      1975  -.5586438  1.0655098  -.6442625   -.1395919    .04823589  -.7042222
      1976  4.4099493   2.783047   1.224238    .7382225  -.023154736 -1.0049963
      1977  -.3375759   .3593845  .04653448   .40331775   -.02530527   .4274552
      1978   .1781428   .2449851  -.4878092   -.2399677    .01596117 -.01406598
      1979  1.0419207    .384033  1.2527897    .5596663  .0022716522 .036265373
      1980   .9817587  1.5234034   .4267486    .5921825   .014349937  -.3305197
      1981   .3842666 -.04288566  -.0588057  -.32790565    .04069948  -.5351281
      1982   .3166945 -.17985135   .7687415    .8153216  -.012685776  -.3424797
      1983   2.773745   2.571451   .9366226   1.1103046  -.005513668  .11159432
      1984   .8404977  .30912805   .9496725    .8827789   -.01543522 -.12059069
      1985    .723146   .8237398  .27580595   .59342194   .010739803   .3617719
      1986  2.2070675  1.6060398  1.0589557    .9092412   -.01013136    -.46076
      1987 -2.2916596 -1.3056936   -.185843  -.19152117  -.032797813  .27034593
      1988 -1.9010205 -2.7576854 -1.1911068   -1.388949   .009019375  -.3210269
      1989 -.52814835  -.7010194 -.15796614   -.2560501     .0247612  .29141963
      1990  -.6228927  -.1756656  .06518078   .09402847    .10807419  .13970327
      1991   .8834122   .6456485  -.4784899   -.3973651  -.012972832  -.7007768
      1992   3.177523  2.8696516  .45812654    .2824707  -.027316093  -.6049224
      1993   .9952512  -.6302409 -.34815645   -.6428354    .09747791 -.14088756
      1994 -1.6830876  -.7722335  -.1210618    .3095286   -.05698776   .3404654
      1995   .5467298  .59251714  .10209417    .4382772   -.08039331   .7159832
      1996  2.0610332  2.3005147  -.3310671   .22561646   -.06083012   .7285892
      1997 -2.2396195  -1.313446    .485805  -.04075527  -.007090092 .022037745
      1998 -.04266119  .59297943  .17318916   .11773682   .034263134   .2918048
      1999  -.7705345  -.5972691   .2707138    .3060293  -.065504074  -.3378398
      2000 -.24594712  -1.568033   .1075697   -.4287343  -.018335342 -.16774917
      2001 -1.9787233 -.02099192  -.4617829  -.18886852   .009590626  .51992583
      2002   .6309826  .27881455  .18304157   -.3131309  -.003203869  -.2383342
      2003   .1474272 -1.0245726 -1.4184122   -.6845551  -.009723663  .21169543
      2004  .28387487  -.4557884  -.1893649 .0006072521  -.008559704   .1674969
      2005 -2.1152122 -1.3046148   .7638936     .437777 -.0017728806  .22368503
      2006  -2.541169 -2.1889184  -.4475203   -.3767607  .0019965172 -.13569331
      2007  1.2422656  1.1198527 -.04471898   -.1028788   .002766609 -.05322909
      2008 -.28497553 -2.1104822 -.16419554   -.8259983  .0022859573 .026313305
      2009  1.0710404   2.011527  -.8857934   -.7744827   .025505066  -1.139676
      end
      
      capture frame drop sandbox 
      
      frame put *, into(sandbox) 
      
      frame sandbox { 
          rename (pri-lp) (Y=)
          reshape long Y, i(year) j(WHICH) string 
          label def which 1 pri 2 gri 3 pec 4 gec 5 lpr 6 lp
          encode WHICH, label(which) gen(which)
          line Y year, by(which, yrescale note("")) ytitle("") xtitle("") scheme(stcolor)
      }
      Click image for larger version

Name:	ferri.png
Views:	1
Size:	94.2 KB
ID:	1717738


      Comment


      • #4
        Thank you both for the contributions. Indeed, I am trying to plot six time series lines together for Italian region macrodata to see their evolution over time and identify any patterns with the second y. I would be grateful if you could help me modify the code as follows

        Based on the code recommended by Devra Golbe in #2 and given that four time series (pri, gri, pec, and gec) are common for all plots and only two time series change in each plot, here in the example, for the first subplot lp and lpr (in total 17 subplots), I had the thought that maybe they could be reported at the bottom right with their labels and line pattern, while the two variables that are different can be reported generally as objective and predicted, one-step, respectively, only by common color and line pattern. From the title of each subplot, one can easily understand what it refers to. Also, for the second y, instead of a title for the second y in each subplot, a generic title should be given to the second as "percentage deviation" when all the plots are combined.This also reduces the information and makes it easier to read.
        Any other solution is acceptable.


        I hope it is clear.

        Thank you again

        Mario

        ​​​​​​

        Comment


        • #5
          Sorry, but I can't absorb what you want from this lengthy word description. If you can show just one of your graphs, you'll be most of the way in working out how far a portfolio of 17 such graphs could work well.

          Comment

          Working...
          X