Announcement

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

  • Combine two plots in the upper and lower parts.

    I am trying to combine scatter plots, which are subdivided into multiple plots. I have two basic variables. Furthermore, I would like to combine them so that the first one is at the top as part one, while the second one is at the bottom as part two. When I do it with the combine, they arise next to each other, which is not what I am aiming for. I'm quoting data and code for a part of them. For better clarity, each group contains about 14 scatter subplots, so I need them to have them as upper part A and lower part B

    Further to this, how could I add three or more y variables in the same scatter plot for a common x counter part?
    Thank you for any help.

    Mario


    Code:
    //  FDI GROUP
    
    // Case A:fd
    scatter fd indicator1, graphr(c(white)) m(Oh) yline(0, lc(navy) lp(dash)) || lfit fd indicator1 ///
        || scatter fd indicator1, mc(navy%10) mlc(none) ml() mlabc(navy) mlabpos(3) ///
        xtitle("indicator1") yt("") ///
        title("A: fd title", size(medsmall)) ///
        legend(off) nodraw name(scatter1) yl(, format(%1.0f))  
        
        
        
    // Case B:ka
    scatter ka indicator1, graphr(c(white)) m(Oh) yline(0, lc(navy) lp(dash)) || lfit ka indicator1 ///
        || scatter ka indicator1, mc(navy%10) mlc(none) ml() mlabc(navy) mlabpos(3) ///
        xtitle("indicator1") yt("") ///
        title("B: ka title", size(medsmall)) ///
        legend(off) nodraw name(scatter2) yl(, format(%1.0f))  
        
        
    // Combine all scatter plots
    graph combine scatter1 scatter2, graphr(c(white)) nodraw name(fd) title("1: FDI GROUP SCATTERPOTS", size(medsmall))
    
    // Drop individual scatter plots
    graph drop scatter1 scatter2
    
    
    
    //  DEVELOP
    
    
    // Case A:ext
    scatter ext indicator1, graphr(c(white)) m(Oh) yline(0, lc(navy) lp(dash)) || lfit ext indicator1 ///
        || scatter ext indicator1, mc(navy%10) mlc(none) ml() mlabc(navy) mlabpos(3) ///
        xtitle("indicator1") yt("") ///
        title("A: ext title", size(medsmall)) ///
        legend(off) nodraw name(scatter1) yl(, format(%1.0f))  
        
    
        
    // Case B:dom
    scatter dom indicator1, graphr(c(white)) m(Oh) yline(0, lc(navy) lp(dash)) || lfit dom indicator1 ///
        || scatter dom indicator1, mc(navy%10) mlc(none) ml() mlabc(navy) mlabpos(3) ///
        xtitle("indicator1") yt("") ///
        title("B: dom title", size(medsmall)) ///
        legend(off) nodraw name(scatter2) yl(, format(%1.0f))  
        
        
    // Combine all scatter plots
    graph combine scatter1 scatter2, graphr(c(white)) nodraw name(dom) title("2: dom GROUP SCATTERPOTS", size(medsmall))
    
    // Drop individual scatter plots
    graph drop scatter1 scatter2
    
    
    
    
    // Combine all scatter plots
    graph combine fd dom, graphr(c(white)) title(" TWO GROUPS SCATTER PLOTS", size(medsmall))

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(id year) str97 country str1 group float(fd ka ext dom pr la type1 type2 indicator1 decade) byte(decade1 decade2 decade3)
    1 1992 "Country1" "A"   .524175   2.321955  .75 .7777778 .071428575        1 0 1       12.2 1990 1 0 0
    1 1993 "Country1" "A"  .5846328   2.321955  .75 .7777778 .071428575        1 0 1  17.553352 1990 1 0 0
    1 1994 "Country1" "A"  .6478685   2.321955  .75 .9444444 .071428575 .7912164 0 1      19.11 1990 1 0 0
    1 2000 "Country1" "A"  .8414965   1.048859  .75        1  .53571427 .7782844 0 1     28.634 2000 0 1 0
    1 2001 "Country1" "A"   .873997   1.048859  .75        1   .6190476 .7782844 0 1   26.41307 2000 0 1 0
    1 2002 "Country1" "A"  .8985876   1.048859  .75        1   .6190476 .7661784 0 1   5.536341 2000 0 1 0
    1 2003 "Country1" "A"  .9015374   1.048859  .75        1   .6190476 .7661784 0 1   5.536341 2000 0 1 0
    1 2004 "Country1" "A"  .9041975   1.048859  .75        1   .6190476 .7661784 0 1   7.350179 2000 0 1 0
    1 2010 "Country1" "A"   .941813   1.048859 .875        1   .8452381 .7704133 0 1   6.241802 2010 0 0 1
    1 2011 "Country1" "A"   .934702   1.048859 .875        1   .8452381 .7704133 0 1      5.068 2010 0 0 1
    1 2012 "Country1" "A"  .9079577   1.303478 .875        1   .8452381 .7704133 0 1      5.068 2010 0 0 1
    1 2013 "Country1" "A"  .8901507  1.5580974 .875        1   .8452381 .7694158 0 1   7.929047 2010 0 0 1
    2 1992 "Country2" "A"   .399736   .6099069 .875 .7777778          0 .5697657 0 1        1.6 1990 1 0 0
    2 1993 "Country2" "A"   .461959  2.0673358 .875 .9444444          0 .5697657 0 1   6.996447 1990 1 0 0
    2 1994 "Country2" "A"  .4953545   2.321955 .875 .9444444          0 .5697657 0 1    8.69136 1990 1 0 0
    2 2000 "Country2" "A"  .7018992   2.321955    1        1   .4404762 .5697657 0 1   2.364474 2000 0 1 0
    2 2001 "Country2" "A"  .7035186   2.321955    1        1   .5952381 .5697657 0 1   2.364474 2000 0 1 0
    2 2002 "Country2" "A"  .6993845   2.321955    1        1   .5952381 .5457992 0 1  -.7668521 2000 0 1 0
    2 2003 "Country2" "A"  .7077955   2.321955    1        1   .5952381 .5457992 0 1 -2.9592714 2000 0 1 0
    2 2004 "Country2" "A"   .728983   2.321955    1        1   .5952381 .5457992 0 1  -2.950783 2000 0 1 0
    2 2010 "Country2" "A"  .7894757   2.321955    1 .9444444   .9166667 .5718316 0 1      3.891 2010 0 0 1
    2 2011 "Country2" "A"  .8007692   2.321955    1 .9444444   .9166667 .5718316 0 1      3.891 2010 0 0 1
    2 2012 "Country2" "A"  .7593077   2.321955    1 .9444444   .9166667 .5718316 0 1 -2.5410414 2010 0 0 1
    2 2013 "Country2" "A"  .7435991   2.321955    1 .9444444   .9166667 .5718316 0 1  -6.333579 2010 0 0 1
    3 1992 "Country3" "B"  .5840359   2.321955    1 .7777778  .08333334 .6281998 0 1   .3835026 1990 1 0 0
    3 1993 "Country3" "B"  .6147648   2.321955    1 .8888889  .08333334 .6281998 0 1   .3835026 1990 1 0 0
    3 1994 "Country3" "B"   .632942   2.321955    1 .8888889  .08333334 .6260909 0 1   .8169867 1990 1 0 0
    3 2000 "Country3" "B"  .7692201   2.321955    1 .8888889        .75 .6297867 0 1  1.9049623 2000 0 1 0
    3 2001 "Country3" "B"  .7502941   2.321955    1 .8888889        .75 .6297867 0 1  1.9049622 2000 0 1 0
    3 2002 "Country3" "B"  .7244223   2.321955    1 .8888889   .8333333 .6297867 0 1   1.283737 2000 0 1 0
    3 2003 "Country3" "B"  .7401305   2.321955    1 .8888889   .8333333 .6297867 0 1 -1.3254085 2000 0 1 0
    3 2004 "Country3" "B"  .7518873   2.321955    1 .8888889   .8333333 .6547069 0 1 -1.3254085 2000 0 1 0
    3 2010 "Country3" "B"  .7356597   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
    3 2011 "Country3" "B"  .7201834   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
    3 2012 "Country3" "B"  .7283527   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
    3 2013 "Country3" "B"  .7077386   2.321955    1 .9444444          1 .6547069 0 1  1.1165322 2010 0 0 1
    4 1992 "Country4" "B"  .3452282   .6099069 .875 .5555556 .071428575 .6121462 0 1   2.615249 1990 1 0 0
    4 1993 "Country4" "B"  .3790323  2.0673358    1 .7222222 .071428575 .6121462 0 1  1.4437795 1990 1 0 0
    4 1994 "Country5" "C"  .4175321   2.321955    1 .7222222 .071428575 .6121462 0 1  4.0116615 1990 1 0 0
    4 2000 "Country5" "C"   .759881   2.321955    1 .8888889   .7619048 .6121462 0 1    5.97681 2000 0 1 0
    4 2001 "Country5" "C"  .7410694   2.321955    1 .8888889   .7619048 .6121462 0 1   7.402936 2000 0 1 0
    4 2002 "Country5" "C"  .7281089   2.321955    1 .8888889   .8333333 .6121462 0 1      8.534 2000 0 1 0
    4 2003 "Country5" "C"   .735869   2.321955    1 .8888889   .8333333 .6263371 0 1      8.534 2000 0 1 0
    4 2004 "Country5" "C"  .7334849   2.321955    1 .8888889   .8333333 .6263371 0 1      8.534 2000 0 1 0
    4 2010 "Country5" "C"  .7798166   2.321955    1 .9444444   .9166667 .6263371 0 1     -16.25 2010 0 0 1
    4 2011 "Country5" "C"  .7637033   2.321955    1 .9444444   .9166667 .6263371 0 1 -14.330358 2010 0 0 1
    4 2012 "Country5" "C"  .7608096   2.321955    1 .9444444   .9166667 .6263371 0 1          0 2010 0 0 1
    4 2013 "Country5" "C"  .7455279   2.321955    1        1   .9166667  .607849 0 1   .6806767 2010 0 0 1
    5 1992 "Country6" "C"  .1757301          .    .        .          .        . 0 1          . 1990 1 0 0
    5 1993 "Country6" "C"  .1761862          .    .        .          .        . 1 0          . 1990 1 0 0
    5 1994 "Country6" "C"  .1562944          .    .        .          .        . 1 0          . 1990 1 0 0
    5 2000 "Country6" "C"  .2008834 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
    5 2001 "Country6" "C" .17261477 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
    5 2002 "Country6" "C" .21249928 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
    5 2003 "Country6" "C"  .2206576 -.02334493    .        .          .        . 1 0          . 2000 0 1 0
    5 2004 "Country6" "C" .23541167 -.02334493    .        .          .        . 1 0          . 2000 0 1 0
    5 2010 "Country6" "C" .27683625   1.249751    .        .          .        . 0 1          . 2010 0 0 1
    5 2011 "Country6" "C" .27487376   1.249751    .        .          .        . 0 1          . 2010 0 0 1
    5 2012 "Country6" "C" .27767062   1.249751    .        .          .        . 0 1          . 2010 0 0 1
    5 2013 "Country6" "C"  .2884341   1.249751    .        .          .        . 0 1          . 2010 0 0 1
    6 1992 "Country7" "C" .25534174  -.1539507 .625       .5          0 .8271327 1 0          . 1990 1 0 0
    6 1993 "Country7" "C" .28078705  -.1539507 .625       .5  .16666667 .8271327 1 0          . 1990 1 0 0
    6 1994 "Country7" "C"  .3567602  -.1539507 .625 .5555556  .16666667 .8271327 1 0          . 1990 1 0 0
    6 2000 "Country7" "C"  .4190661 -1.2261546 .625 .6111111  .23809524 .8271327 0 1          . 2000 0 1 0
    6 2001 "Country7" "C"  .3738855 -1.2261546 .625 .6666667   .3928571 .8271327 0 1          . 2000 0 1 0
    6 2002 "Country7" "C"   .404098 -1.2261546 .625 .6666667   .3928571 .8271327 0 1          . 2000 0 1 0
    6 2003 "Country7" "C"  .4157713 -1.2261546 .875 .6666667   .3928571 .7653575 0 1          . 2000 0 1 0
    6 2004 "Country7" "C"  .4085605 -1.2261546 .875 .6666667  .53571427 .7653575 0 1          . 2000 0 1 0
    6 2010 "Country7" "C"  .4888775 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
    6 2011 "Country7" "C"  .4789392 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
    6 2012 "Country7" "C"  .4922497 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
    6 2013 "Country7" "C"   .508882 -.02334493  .75 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
    7 1992 "Country8" "D" .56565696   2.321955    1 .9444444   .7738096 .8009957 0 1  13.403038 1990 1 0 0
    7 1993 "Country8" "D"  .6403931   2.321955    1 .9444444   .7738096 .8070084 0 1       12.1 1990 1 0 0
    7 1994 "Country8" "D"  .6921942   2.321955    1 .9444444   .8452381 .8070084 0 1       12.1 1990 1 0 0
    7 2000 "Country8" "D"  .8552948   2.321955    1        1   .9285714 .8314556 0 1      1.806 2000 0 1 0
    7 2001 "Country8" "D"  .8805222   2.321955    1        1   .9285714 .8314556 0 1   1.958802 2000 0 1 0
    7 2002 "Country8" "D"  .8265579   2.321955    1        1   .9285714 .8314556 0 1      2.076 2000 0 1 0
    7 2003 "Country8" "D"  .8580942   2.321955    1        1          1 .8314556 0 1      2.076 2000 0 1 0
    7 2004 "Country8" "D"  .8708485   2.321955    1        1          1 .8314556 0 1      2.076 2000 0 1 0
    7 2010 "Country8" "D"  .8683383   2.321955    1        1          1 .8314556 0 1   3.564247 2010 0 0 1
    7 2011 "Country8" "D"  .8672714   2.321955    1 .9444444          1 .8314556 0 1   5.454876 2010 0 0 1
    7 2012 "Country8" "D"  .8684435   2.321955    1 .8888889          1 .8429364 0 1   5.454876 2010 0 0 1
    7 2013 "Country8" "D"  .8866873   2.321955    1 .9444444          1 .8429364 0 1   5.454876 2010 0 0 1
    8 1992 "Country8" "D"  .5748482   2.321955    1 .8888889  .52380955 .9702252 0 1       14.9 1990 1 0 0
    8 1993 "Country8" "D"  .6702072   2.321955    1 .8888889  .52380955 .9702252 0 1   .0375137 1990 1 0 0
    8 1994 "Country8" "D"  .6812267   2.321955    1 .8888889  .52380955 .9702252 0 1      -.781 1990 1 0 0
    8 2000 "Country8" "D"  .8790284   2.321955    1        1        .75 .9702252 0 1      1.463 2000 0 1 0
    8 2001 "Country8" "D"   .889005   2.321955    1        1        .75 .9702252 0 1   5.542341 2000 0 1 0
    8 2002 "Country8" "D"  .8849987   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
    8 2003 "Country8" "D"  .8916724   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
    8 2004 "Country8" "D"  .8910962   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
    8 2010 "Country8" "D"  .8951228   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
    8 2011 "Country8" "D"  .8785759   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
    8 2012 "Country8" "D"  .8894278   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
    8 2013 "Country8" "D"  .8901961   2.321955    1        1   .8333333 .9702252 0 1   1.298654 2010 0 0 1
    end
    ------------------ copy up to and including the previous line ------------------
    Last edited by Mario Ferri; 05 Sep 2023, 20:44.

  • #2
    Dear Mario,

    Possibly this post might be helpfull.
    http://publicationslist.org/eric.melse

    Comment


    • #3
      Originally posted by ericmelse View Post
      Dear Mario,

      Possibly this post might be helpfull.
      Thank you very much, Eric. Not quite what I am looking. I am looking to create a two parts plot with part A on the top and Part B at the lower bottom.
      Your suggestion, however, and the discussion on that page helped to get the idea on how to zoom in a plot.

      Comment


      • #4
        Originally posted by ericmelse View Post
        Dear Mario,

        Possibly this post might be helpfull.
        Thank you very much, Eric. Not quite what I am looking for. I am looking to create a two-part plot with Part A on top and Part B at the bottom.
        Your suggestion, however, and the discussion on that page helped me get an idea of how to zoom in within a plot.
        Last edited by Mario Ferri; 06 Sep 2023, 13:58.

        Comment


        • #5
          Furthermore, I would like to combine them so that the first one is at the top as part one, while the second one is at the bottom as part two. When I do it with the combine, they arise next to each other, which is not what I am aiming for.
          I am not sure that I understand your question. If you want to append the graphs when using gr combine, use the -col()- option.

          Code:
          graph combine scatter1 scatter2, graphr(c(white)) ///
              title("1: FDI GROUP SCATTERPOTS", size(medsmall)) col(1)
          On the other hand, if you want to have both in the same plot and not use gr combine, then note that moving the points along the axis amounts to adding a constant value to the \(y\) variable.

          Comment


          • #6
            Originally posted by Andrew Musau View Post

            I am not sure that I understand your question. If you want to append the graphs when using gr combine, use the -col()- option.

            Code:
            graph combine scatter1 scatter2, graphr(c(white)) ///
            title("1: FDI GROUP SCATTERPOTS", size(medsmall)) col(1)
            On the other hand, if you want to have both in the same plot and not use gr combine, then note that moving the points along the axis amounts to adding a constant value to the \(y\) variable.
            Thank you very much Andrew! Exactly what I was looking for.
            Can I ask you something else? I'm not supposed to spam the forum. Instead of individual scatter plots, I would like to include multiple Ys in the same scatter plot with 'fd', 'ka', 'ext, 'dom, 'pr, and 'la' against the common x variable indicator1, distinct line trends , symbols, colors, and labels for each one of them.
            The labels for the variables are Indicator1: "weighted indicator1", fd : "foreign developed", ka "current developed', ext : "external developed", dom : "domestic developed," and pr: " private development."
            It should be titled ("Effects of Weighted Indicaror1 Against group A" )

            For the individual pair cases, I used the codes and data above.

            Many thanks again for your time and help!

            Comment


            • #7
              Below, sepscatter is from SSC. You can rename elements in the legend, I do not do this.

              Code:
              * Example generated by -dataex-. For more info, type help dataex
              clear
              input float(id year) str97 country str1 group float(fd ka ext dom pr la type1 type2 indicator1 decade) byte(decade1 decade2 decade3)
              1 1992 "Country1" "A"   .524175   2.321955  .75 .7777778 .071428575        1 0 1       12.2 1990 1 0 0
              1 1993 "Country1" "A"  .5846328   2.321955  .75 .7777778 .071428575        1 0 1  17.553352 1990 1 0 0
              1 1994 "Country1" "A"  .6478685   2.321955  .75 .9444444 .071428575 .7912164 0 1      19.11 1990 1 0 0
              1 2000 "Country1" "A"  .8414965   1.048859  .75        1  .53571427 .7782844 0 1     28.634 2000 0 1 0
              1 2001 "Country1" "A"   .873997   1.048859  .75        1   .6190476 .7782844 0 1   26.41307 2000 0 1 0
              1 2002 "Country1" "A"  .8985876   1.048859  .75        1   .6190476 .7661784 0 1   5.536341 2000 0 1 0
              1 2003 "Country1" "A"  .9015374   1.048859  .75        1   .6190476 .7661784 0 1   5.536341 2000 0 1 0
              1 2004 "Country1" "A"  .9041975   1.048859  .75        1   .6190476 .7661784 0 1   7.350179 2000 0 1 0
              1 2010 "Country1" "A"   .941813   1.048859 .875        1   .8452381 .7704133 0 1   6.241802 2010 0 0 1
              1 2011 "Country1" "A"   .934702   1.048859 .875        1   .8452381 .7704133 0 1      5.068 2010 0 0 1
              1 2012 "Country1" "A"  .9079577   1.303478 .875        1   .8452381 .7704133 0 1      5.068 2010 0 0 1
              1 2013 "Country1" "A"  .8901507  1.5580974 .875        1   .8452381 .7694158 0 1   7.929047 2010 0 0 1
              2 1992 "Country2" "A"   .399736   .6099069 .875 .7777778          0 .5697657 0 1        1.6 1990 1 0 0
              2 1993 "Country2" "A"   .461959  2.0673358 .875 .9444444          0 .5697657 0 1   6.996447 1990 1 0 0
              2 1994 "Country2" "A"  .4953545   2.321955 .875 .9444444          0 .5697657 0 1    8.69136 1990 1 0 0
              2 2000 "Country2" "A"  .7018992   2.321955    1        1   .4404762 .5697657 0 1   2.364474 2000 0 1 0
              2 2001 "Country2" "A"  .7035186   2.321955    1        1   .5952381 .5697657 0 1   2.364474 2000 0 1 0
              2 2002 "Country2" "A"  .6993845   2.321955    1        1   .5952381 .5457992 0 1  -.7668521 2000 0 1 0
              2 2003 "Country2" "A"  .7077955   2.321955    1        1   .5952381 .5457992 0 1 -2.9592714 2000 0 1 0
              2 2004 "Country2" "A"   .728983   2.321955    1        1   .5952381 .5457992 0 1  -2.950783 2000 0 1 0
              2 2010 "Country2" "A"  .7894757   2.321955    1 .9444444   .9166667 .5718316 0 1      3.891 2010 0 0 1
              2 2011 "Country2" "A"  .8007692   2.321955    1 .9444444   .9166667 .5718316 0 1      3.891 2010 0 0 1
              2 2012 "Country2" "A"  .7593077   2.321955    1 .9444444   .9166667 .5718316 0 1 -2.5410414 2010 0 0 1
              2 2013 "Country2" "A"  .7435991   2.321955    1 .9444444   .9166667 .5718316 0 1  -6.333579 2010 0 0 1
              3 1992 "Country3" "B"  .5840359   2.321955    1 .7777778  .08333334 .6281998 0 1   .3835026 1990 1 0 0
              3 1993 "Country3" "B"  .6147648   2.321955    1 .8888889  .08333334 .6281998 0 1   .3835026 1990 1 0 0
              3 1994 "Country3" "B"   .632942   2.321955    1 .8888889  .08333334 .6260909 0 1   .8169867 1990 1 0 0
              3 2000 "Country3" "B"  .7692201   2.321955    1 .8888889        .75 .6297867 0 1  1.9049623 2000 0 1 0
              3 2001 "Country3" "B"  .7502941   2.321955    1 .8888889        .75 .6297867 0 1  1.9049622 2000 0 1 0
              3 2002 "Country3" "B"  .7244223   2.321955    1 .8888889   .8333333 .6297867 0 1   1.283737 2000 0 1 0
              3 2003 "Country3" "B"  .7401305   2.321955    1 .8888889   .8333333 .6297867 0 1 -1.3254085 2000 0 1 0
              3 2004 "Country3" "B"  .7518873   2.321955    1 .8888889   .8333333 .6547069 0 1 -1.3254085 2000 0 1 0
              3 2010 "Country3" "B"  .7356597   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
              3 2011 "Country3" "B"  .7201834   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
              3 2012 "Country3" "B"  .7283527   2.321955    1 .9444444          1 .6547069 0 1  1.1606808 2010 0 0 1
              3 2013 "Country3" "B"  .7077386   2.321955    1 .9444444          1 .6547069 0 1  1.1165322 2010 0 0 1
              4 1992 "Country4" "B"  .3452282   .6099069 .875 .5555556 .071428575 .6121462 0 1   2.615249 1990 1 0 0
              4 1993 "Country4" "B"  .3790323  2.0673358    1 .7222222 .071428575 .6121462 0 1  1.4437795 1990 1 0 0
              4 1994 "Country5" "C"  .4175321   2.321955    1 .7222222 .071428575 .6121462 0 1  4.0116615 1990 1 0 0
              4 2000 "Country5" "C"   .759881   2.321955    1 .8888889   .7619048 .6121462 0 1    5.97681 2000 0 1 0
              4 2001 "Country5" "C"  .7410694   2.321955    1 .8888889   .7619048 .6121462 0 1   7.402936 2000 0 1 0
              4 2002 "Country5" "C"  .7281089   2.321955    1 .8888889   .8333333 .6121462 0 1      8.534 2000 0 1 0
              4 2003 "Country5" "C"   .735869   2.321955    1 .8888889   .8333333 .6263371 0 1      8.534 2000 0 1 0
              4 2004 "Country5" "C"  .7334849   2.321955    1 .8888889   .8333333 .6263371 0 1      8.534 2000 0 1 0
              4 2010 "Country5" "C"  .7798166   2.321955    1 .9444444   .9166667 .6263371 0 1     -16.25 2010 0 0 1
              4 2011 "Country5" "C"  .7637033   2.321955    1 .9444444   .9166667 .6263371 0 1 -14.330358 2010 0 0 1
              4 2012 "Country5" "C"  .7608096   2.321955    1 .9444444   .9166667 .6263371 0 1          0 2010 0 0 1
              4 2013 "Country5" "C"  .7455279   2.321955    1        1   .9166667  .607849 0 1   .6806767 2010 0 0 1
              5 1992 "Country6" "C"  .1757301          .    .        .          .        . 0 1          . 1990 1 0 0
              5 1993 "Country6" "C"  .1761862          .    .        .          .        . 1 0          . 1990 1 0 0
              5 1994 "Country6" "C"  .1562944          .    .        .          .        . 1 0          . 1990 1 0 0
              5 2000 "Country6" "C"  .2008834 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
              5 2001 "Country6" "C" .17261477 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
              5 2002 "Country6" "C" .21249928 -1.2261546    .        .          .        . 1 0          . 2000 0 1 0
              5 2003 "Country6" "C"  .2206576 -.02334493    .        .          .        . 1 0          . 2000 0 1 0
              5 2004 "Country6" "C" .23541167 -.02334493    .        .          .        . 1 0          . 2000 0 1 0
              5 2010 "Country6" "C" .27683625   1.249751    .        .          .        . 0 1          . 2010 0 0 1
              5 2011 "Country6" "C" .27487376   1.249751    .        .          .        . 0 1          . 2010 0 0 1
              5 2012 "Country6" "C" .27767062   1.249751    .        .          .        . 0 1          . 2010 0 0 1
              5 2013 "Country6" "C"  .2884341   1.249751    .        .          .        . 0 1          . 2010 0 0 1
              6 1992 "Country7" "C" .25534174  -.1539507 .625       .5          0 .8271327 1 0          . 1990 1 0 0
              6 1993 "Country7" "C" .28078705  -.1539507 .625       .5  .16666667 .8271327 1 0          . 1990 1 0 0
              6 1994 "Country7" "C"  .3567602  -.1539507 .625 .5555556  .16666667 .8271327 1 0          . 1990 1 0 0
              6 2000 "Country7" "C"  .4190661 -1.2261546 .625 .6111111  .23809524 .8271327 0 1          . 2000 0 1 0
              6 2001 "Country7" "C"  .3738855 -1.2261546 .625 .6666667   .3928571 .8271327 0 1          . 2000 0 1 0
              6 2002 "Country7" "C"   .404098 -1.2261546 .625 .6666667   .3928571 .8271327 0 1          . 2000 0 1 0
              6 2003 "Country7" "C"  .4157713 -1.2261546 .875 .6666667   .3928571 .7653575 0 1          . 2000 0 1 0
              6 2004 "Country7" "C"  .4085605 -1.2261546 .875 .6666667  .53571427 .7653575 0 1          . 2000 0 1 0
              6 2010 "Country7" "C"  .4888775 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
              6 2011 "Country7" "C"  .4789392 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
              6 2012 "Country7" "C"  .4922497 -.02334493 .875 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
              6 2013 "Country7" "C"   .508882 -.02334493  .75 .6666667   .7619048 .7653575 0 1          . 2010 0 0 1
              7 1992 "Country8" "D" .56565696   2.321955    1 .9444444   .7738096 .8009957 0 1  13.403038 1990 1 0 0
              7 1993 "Country8" "D"  .6403931   2.321955    1 .9444444   .7738096 .8070084 0 1       12.1 1990 1 0 0
              7 1994 "Country8" "D"  .6921942   2.321955    1 .9444444   .8452381 .8070084 0 1       12.1 1990 1 0 0
              7 2000 "Country8" "D"  .8552948   2.321955    1        1   .9285714 .8314556 0 1      1.806 2000 0 1 0
              7 2001 "Country8" "D"  .8805222   2.321955    1        1   .9285714 .8314556 0 1   1.958802 2000 0 1 0
              7 2002 "Country8" "D"  .8265579   2.321955    1        1   .9285714 .8314556 0 1      2.076 2000 0 1 0
              7 2003 "Country8" "D"  .8580942   2.321955    1        1          1 .8314556 0 1      2.076 2000 0 1 0
              7 2004 "Country8" "D"  .8708485   2.321955    1        1          1 .8314556 0 1      2.076 2000 0 1 0
              7 2010 "Country8" "D"  .8683383   2.321955    1        1          1 .8314556 0 1   3.564247 2010 0 0 1
              7 2011 "Country8" "D"  .8672714   2.321955    1 .9444444          1 .8314556 0 1   5.454876 2010 0 0 1
              7 2012 "Country8" "D"  .8684435   2.321955    1 .8888889          1 .8429364 0 1   5.454876 2010 0 0 1
              7 2013 "Country8" "D"  .8866873   2.321955    1 .9444444          1 .8429364 0 1   5.454876 2010 0 0 1
              8 1992 "Country8" "D"  .5748482   2.321955    1 .8888889  .52380955 .9702252 0 1       14.9 1990 1 0 0
              8 1993 "Country8" "D"  .6702072   2.321955    1 .8888889  .52380955 .9702252 0 1   .0375137 1990 1 0 0
              8 1994 "Country8" "D"  .6812267   2.321955    1 .8888889  .52380955 .9702252 0 1      -.781 1990 1 0 0
              8 2000 "Country8" "D"  .8790284   2.321955    1        1        .75 .9702252 0 1      1.463 2000 0 1 0
              8 2001 "Country8" "D"   .889005   2.321955    1        1        .75 .9702252 0 1   5.542341 2000 0 1 0
              8 2002 "Country8" "D"  .8849987   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
              8 2003 "Country8" "D"  .8916724   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
              8 2004 "Country8" "D"  .8910962   2.321955    1        1        .75 .9702252 0 1      5.767 2000 0 1 0
              8 2010 "Country8" "D"  .8951228   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
              8 2011 "Country8" "D"  .8785759   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
              8 2012 "Country8" "D"  .8894278   2.321955    1        1   .8333333 .9702252 0 1       -.36 2010 0 0 1
              8 2013 "Country8" "D"  .8901961   2.321955    1        1   .8333333 .9702252 0 1   1.298654 2010 0 0 1
              end
              
              rename  (fd ka ext dom pr) var=
              reshape long var, i(id year) j(cat) string
              set scheme s1color
              sepscatter var indicator1, separate(cat) ytitle("") xtitle("Weighted Indicaror1") title("Effects of Weighted Indicaror1 Against group A")
              Click image for larger version

Name:	Graph.png
Views:	1
Size:	48.2 KB
ID:	1726280

              Comment


              • #8
                Originally posted by Andrew Musau View Post
                Below, sepscatter is from SSC. You can rename elements in the legend, I do not do this.

                Code:
                * Example generated by -dataex-. For more info, type help dataex
                clear
                input float(id year) str97 country str1 group float(fd ka ext dom pr la type1 type2 indicator1 decade) byte(decade1 decade2 decade3)
                1 1992 "Country1" "A" .524175 2.321955 .75 .7777778 .071428575 1 0 1 12.2 1990 1 0 0
                1 1993 "Country1" "A" .5846328 2.321955 .75 .7777778 .071428575 1 0 1 17.553352 1990 1 0 0
                1 1994 "Country1" "A" .6478685 2.321955 .75 .9444444 .071428575 .7912164 0 1 19.11 1990 1 0 0
                1 2000 "Country1" "A" .8414965 1.048859 .75 1 .53571427 .7782844 0 1 28.634 2000 0 1 0
                1 2001 "Country1" "A" .873997 1.048859 .75 1 .6190476 .7782844 0 1 26.41307 2000 0 1 0
                1 2002 "Country1" "A" .8985876 1.048859 .75 1 .6190476 .7661784 0 1 5.536341 2000 0 1 0
                1 2003 "Country1" "A" .9015374 1.048859 .75 1 .6190476 .7661784 0 1 5.536341 2000 0 1 0
                1 2004 "Country1" "A" .9041975 1.048859 .75 1 .6190476 .7661784 0 1 7.350179 2000 0 1 0
                1 2010 "Country1" "A" .941813 1.048859 .875 1 .8452381 .7704133 0 1 6.241802 2010 0 0 1
                1 2011 "Country1" "A" .934702 1.048859 .875 1 .8452381 .7704133 0 1 5.068 2010 0 0 1
                1 2012 "Country1" "A" .9079577 1.303478 .875 1 .8452381 .7704133 0 1 5.068 2010 0 0 1
                1 2013 "Country1" "A" .8901507 1.5580974 .875 1 .8452381 .7694158 0 1 7.929047 2010 0 0 1
                2 1992 "Country2" "A" .399736 .6099069 .875 .7777778 0 .5697657 0 1 1.6 1990 1 0 0
                2 1993 "Country2" "A" .461959 2.0673358 .875 .9444444 0 .5697657 0 1 6.996447 1990 1 0 0
                2 1994 "Country2" "A" .4953545 2.321955 .875 .9444444 0 .5697657 0 1 8.69136 1990 1 0 0
                2 2000 "Country2" "A" .7018992 2.321955 1 1 .4404762 .5697657 0 1 2.364474 2000 0 1 0
                2 2001 "Country2" "A" .7035186 2.321955 1 1 .5952381 .5697657 0 1 2.364474 2000 0 1 0
                2 2002 "Country2" "A" .6993845 2.321955 1 1 .5952381 .5457992 0 1 -.7668521 2000 0 1 0
                2 2003 "Country2" "A" .7077955 2.321955 1 1 .5952381 .5457992 0 1 -2.9592714 2000 0 1 0
                2 2004 "Country2" "A" .728983 2.321955 1 1 .5952381 .5457992 0 1 -2.950783 2000 0 1 0
                2 2010 "Country2" "A" .7894757 2.321955 1 .9444444 .9166667 .5718316 0 1 3.891 2010 0 0 1
                2 2011 "Country2" "A" .8007692 2.321955 1 .9444444 .9166667 .5718316 0 1 3.891 2010 0 0 1
                2 2012 "Country2" "A" .7593077 2.321955 1 .9444444 .9166667 .5718316 0 1 -2.5410414 2010 0 0 1
                2 2013 "Country2" "A" .7435991 2.321955 1 .9444444 .9166667 .5718316 0 1 -6.333579 2010 0 0 1
                3 1992 "Country3" "B" .5840359 2.321955 1 .7777778 .08333334 .6281998 0 1 .3835026 1990 1 0 0
                3 1993 "Country3" "B" .6147648 2.321955 1 .8888889 .08333334 .6281998 0 1 .3835026 1990 1 0 0
                3 1994 "Country3" "B" .632942 2.321955 1 .8888889 .08333334 .6260909 0 1 .8169867 1990 1 0 0
                3 2000 "Country3" "B" .7692201 2.321955 1 .8888889 .75 .6297867 0 1 1.9049623 2000 0 1 0
                3 2001 "Country3" "B" .7502941 2.321955 1 .8888889 .75 .6297867 0 1 1.9049622 2000 0 1 0
                3 2002 "Country3" "B" .7244223 2.321955 1 .8888889 .8333333 .6297867 0 1 1.283737 2000 0 1 0
                3 2003 "Country3" "B" .7401305 2.321955 1 .8888889 .8333333 .6297867 0 1 -1.3254085 2000 0 1 0
                3 2004 "Country3" "B" .7518873 2.321955 1 .8888889 .8333333 .6547069 0 1 -1.3254085 2000 0 1 0
                3 2010 "Country3" "B" .7356597 2.321955 1 .9444444 1 .6547069 0 1 1.1606808 2010 0 0 1
                3 2011 "Country3" "B" .7201834 2.321955 1 .9444444 1 .6547069 0 1 1.1606808 2010 0 0 1
                3 2012 "Country3" "B" .7283527 2.321955 1 .9444444 1 .6547069 0 1 1.1606808 2010 0 0 1
                3 2013 "Country3" "B" .7077386 2.321955 1 .9444444 1 .6547069 0 1 1.1165322 2010 0 0 1
                4 1992 "Country4" "B" .3452282 .6099069 .875 .5555556 .071428575 .6121462 0 1 2.615249 1990 1 0 0
                4 1993 "Country4" "B" .3790323 2.0673358 1 .7222222 .071428575 .6121462 0 1 1.4437795 1990 1 0 0
                4 1994 "Country5" "C" .4175321 2.321955 1 .7222222 .071428575 .6121462 0 1 4.0116615 1990 1 0 0
                4 2000 "Country5" "C" .759881 2.321955 1 .8888889 .7619048 .6121462 0 1 5.97681 2000 0 1 0
                4 2001 "Country5" "C" .7410694 2.321955 1 .8888889 .7619048 .6121462 0 1 7.402936 2000 0 1 0
                4 2002 "Country5" "C" .7281089 2.321955 1 .8888889 .8333333 .6121462 0 1 8.534 2000 0 1 0
                4 2003 "Country5" "C" .735869 2.321955 1 .8888889 .8333333 .6263371 0 1 8.534 2000 0 1 0
                4 2004 "Country5" "C" .7334849 2.321955 1 .8888889 .8333333 .6263371 0 1 8.534 2000 0 1 0
                4 2010 "Country5" "C" .7798166 2.321955 1 .9444444 .9166667 .6263371 0 1 -16.25 2010 0 0 1
                4 2011 "Country5" "C" .7637033 2.321955 1 .9444444 .9166667 .6263371 0 1 -14.330358 2010 0 0 1
                4 2012 "Country5" "C" .7608096 2.321955 1 .9444444 .9166667 .6263371 0 1 0 2010 0 0 1
                4 2013 "Country5" "C" .7455279 2.321955 1 1 .9166667 .607849 0 1 .6806767 2010 0 0 1
                5 1992 "Country6" "C" .1757301 . . . . . 0 1 . 1990 1 0 0
                5 1993 "Country6" "C" .1761862 . . . . . 1 0 . 1990 1 0 0
                5 1994 "Country6" "C" .1562944 . . . . . 1 0 . 1990 1 0 0
                5 2000 "Country6" "C" .2008834 -1.2261546 . . . . 1 0 . 2000 0 1 0
                5 2001 "Country6" "C" .17261477 -1.2261546 . . . . 1 0 . 2000 0 1 0
                5 2002 "Country6" "C" .21249928 -1.2261546 . . . . 1 0 . 2000 0 1 0
                5 2003 "Country6" "C" .2206576 -.02334493 . . . . 1 0 . 2000 0 1 0
                5 2004 "Country6" "C" .23541167 -.02334493 . . . . 1 0 . 2000 0 1 0
                5 2010 "Country6" "C" .27683625 1.249751 . . . . 0 1 . 2010 0 0 1
                5 2011 "Country6" "C" .27487376 1.249751 . . . . 0 1 . 2010 0 0 1
                5 2012 "Country6" "C" .27767062 1.249751 . . . . 0 1 . 2010 0 0 1
                5 2013 "Country6" "C" .2884341 1.249751 . . . . 0 1 . 2010 0 0 1
                6 1992 "Country7" "C" .25534174 -.1539507 .625 .5 0 .8271327 1 0 . 1990 1 0 0
                6 1993 "Country7" "C" .28078705 -.1539507 .625 .5 .16666667 .8271327 1 0 . 1990 1 0 0
                6 1994 "Country7" "C" .3567602 -.1539507 .625 .5555556 .16666667 .8271327 1 0 . 1990 1 0 0
                6 2000 "Country7" "C" .4190661 -1.2261546 .625 .6111111 .23809524 .8271327 0 1 . 2000 0 1 0
                6 2001 "Country7" "C" .3738855 -1.2261546 .625 .6666667 .3928571 .8271327 0 1 . 2000 0 1 0
                6 2002 "Country7" "C" .404098 -1.2261546 .625 .6666667 .3928571 .8271327 0 1 . 2000 0 1 0
                6 2003 "Country7" "C" .4157713 -1.2261546 .875 .6666667 .3928571 .7653575 0 1 . 2000 0 1 0
                6 2004 "Country7" "C" .4085605 -1.2261546 .875 .6666667 .53571427 .7653575 0 1 . 2000 0 1 0
                6 2010 "Country7" "C" .4888775 -.02334493 .875 .6666667 .7619048 .7653575 0 1 . 2010 0 0 1
                6 2011 "Country7" "C" .4789392 -.02334493 .875 .6666667 .7619048 .7653575 0 1 . 2010 0 0 1
                6 2012 "Country7" "C" .4922497 -.02334493 .875 .6666667 .7619048 .7653575 0 1 . 2010 0 0 1
                6 2013 "Country7" "C" .508882 -.02334493 .75 .6666667 .7619048 .7653575 0 1 . 2010 0 0 1
                7 1992 "Country8" "D" .56565696 2.321955 1 .9444444 .7738096 .8009957 0 1 13.403038 1990 1 0 0
                7 1993 "Country8" "D" .6403931 2.321955 1 .9444444 .7738096 .8070084 0 1 12.1 1990 1 0 0
                7 1994 "Country8" "D" .6921942 2.321955 1 .9444444 .8452381 .8070084 0 1 12.1 1990 1 0 0
                7 2000 "Country8" "D" .8552948 2.321955 1 1 .9285714 .8314556 0 1 1.806 2000 0 1 0
                7 2001 "Country8" "D" .8805222 2.321955 1 1 .9285714 .8314556 0 1 1.958802 2000 0 1 0
                7 2002 "Country8" "D" .8265579 2.321955 1 1 .9285714 .8314556 0 1 2.076 2000 0 1 0
                7 2003 "Country8" "D" .8580942 2.321955 1 1 1 .8314556 0 1 2.076 2000 0 1 0
                7 2004 "Country8" "D" .8708485 2.321955 1 1 1 .8314556 0 1 2.076 2000 0 1 0
                7 2010 "Country8" "D" .8683383 2.321955 1 1 1 .8314556 0 1 3.564247 2010 0 0 1
                7 2011 "Country8" "D" .8672714 2.321955 1 .9444444 1 .8314556 0 1 5.454876 2010 0 0 1
                7 2012 "Country8" "D" .8684435 2.321955 1 .8888889 1 .8429364 0 1 5.454876 2010 0 0 1
                7 2013 "Country8" "D" .8866873 2.321955 1 .9444444 1 .8429364 0 1 5.454876 2010 0 0 1
                8 1992 "Country8" "D" .5748482 2.321955 1 .8888889 .52380955 .9702252 0 1 14.9 1990 1 0 0
                8 1993 "Country8" "D" .6702072 2.321955 1 .8888889 .52380955 .9702252 0 1 .0375137 1990 1 0 0
                8 1994 "Country8" "D" .6812267 2.321955 1 .8888889 .52380955 .9702252 0 1 -.781 1990 1 0 0
                8 2000 "Country8" "D" .8790284 2.321955 1 1 .75 .9702252 0 1 1.463 2000 0 1 0
                8 2001 "Country8" "D" .889005 2.321955 1 1 .75 .9702252 0 1 5.542341 2000 0 1 0
                8 2002 "Country8" "D" .8849987 2.321955 1 1 .75 .9702252 0 1 5.767 2000 0 1 0
                8 2003 "Country8" "D" .8916724 2.321955 1 1 .75 .9702252 0 1 5.767 2000 0 1 0
                8 2004 "Country8" "D" .8910962 2.321955 1 1 .75 .9702252 0 1 5.767 2000 0 1 0
                8 2010 "Country8" "D" .8951228 2.321955 1 1 .8333333 .9702252 0 1 -.36 2010 0 0 1
                8 2011 "Country8" "D" .8785759 2.321955 1 1 .8333333 .9702252 0 1 -.36 2010 0 0 1
                8 2012 "Country8" "D" .8894278 2.321955 1 1 .8333333 .9702252 0 1 -.36 2010 0 0 1
                8 2013 "Country8" "D" .8901961 2.321955 1 1 .8333333 .9702252 0 1 1.298654 2010 0 0 1
                end
                
                rename (fd ka ext dom pr) var=
                reshape long var, i(id year) j(cat) string
                set scheme s1color
                sepscatter var indicator1, separate(cat) ytitle("") xtitle("Weighted Indicaror1") title("Effects of Weighted Indicaror1 Against group A")
                [ATTACH=CONFIG]n1726280[/ATTACH]


                Thank you much for your reply and time. Is it possible to add a lfit line for each pair of Y valuables and X (with different line pattern, of course) to reveal any trends, similar to the individual pair cases I have above in #1? That will be the final form of the scatter I'm looking for.

                Comment


                • #9
                  Do not quote the entire post if you are not referring to something specific. Below, I may want to highlight your specific question, in which case I can have:

                  Is it possible to add a lfit line for each pair of Y valuables and X (with different line pattern, of course) to reveal any trends, similar to the individual pair cases I have above in #1?
                  [.] Otherwise, I would just write my response directly. On your question, sepscatter supports twoway options, and therefore you can add these using the -addplot()- option.

                  Code:
                  addplot(lfit x1 y1, lc(red) lp(dash) || lfit x2 y2, lc(blue) lp(solid) || ... )

                  Comment


                  • #10
                    Originally posted by Andrew Musau View Post
                    Do not quote the entire post if you are not referring to something specific. Below, I may want to highlight your specific question, in which case I can have:



                    [.] Otherwise, I would just write my response directly. On your question, sepscatter supports twoway options, and therefore you can add these using the -addplot()- option.

                    Code:
                    addplot(lfit x1 y1, lc(red) lp(dash) || lfit x2 y2, lc(blue) lp(solid) || ... )

                    Thank you very much, Andrew! I will give it a try, and allow me to get back to you should I need anything else on that!

                    Comment

                    Working...
                    X