Announcement

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

  • when combining graphs, can we put the three figures in a triangular position?

    I know a useful command grc1leg2, can we use it to combine three figures in a triangular position, shown as below?
    Or do we have other command to realize this?
    Click image for larger version

Name:	WechatIMG311.jpeg
Views:	1
Size:	35.7 KB
ID:	1622655
    Last edited by Fred Lee; 10 Aug 2021, 07:09.

  • #2
    Code:
    sysuse auto
    scatter mpg price,name(gr1,replace)
    grc1leg gr1 gr1 gr1 , col(3) row(2) holes(1 3 5)

    Comment


    • #3
      Originally posted by Scott Merryman View Post
      Code:
      sysuse auto
      scatter mpg price,name(gr1,replace)
      grc1leg gr1 gr1 gr1 , col(3) row(2) holes(1 3 5)
      Great and thanks!

      Comment


      • #4
        Originally posted by Scott Merryman View Post
        Code:
        sysuse auto
        scatter mpg price,name(gr1,replace)
        grc1leg gr1 gr1 gr1 , col(3) row(2) holes(1 3 5)
        I found in this way, the figures become quite small, since theoretically there exists six figures.
        Do we have alternatives to make each sub-figure bigger? Thanks again!

        Comment


        • #5
          The issue is whether you want to align the right hand axis of figure 2 with the left hand axis of figure 1 and the left hand axis of figure 3 with the right hand axis of figure 1. If this does not matter, then just manipulate the sides margins of figure 1 and combine with figure 2 and figure 3.

          Code:
          sysuse auto, clear
          set scheme s1mono
          scatter mpg price, saving(gr1,replace) graphregion(margin(50 50 0 0))
          scatter mpg weight, saving(gr2,replace)
          gr combine gr2.gph gr2.gph, saving(gr3,replace) row(1)
          gr combine gr1.gph gr3.gph, row(2)
          Click image for larger version

Name:	Graph.png
Views:	1
Size:	63.1 KB
ID:	1622763

          Last edited by Andrew Musau; 10 Aug 2021, 21:08.

          Comment


          • #6
            Originally posted by Andrew Musau View Post
            The issue is whether you want to align the right hand side of figure 2 with the left hand side of figure 1 and the left hand side of figure 3 with the right hand side of figure 1. If this does not matter, then just manipulate the sides margins of figure 1 and combine with figure 2 and figure 3.

            Code:
            sysuse auto, clear
            set scheme s1mono
            scatter mpg price, saving(gr1,replace) graphregion(margin(50 50 0 0))
            scatter mpg weight, saving(gr2,replace)
            gr combine gr2.gph gr2.gph, saving(gr3,replace) row(1)
            gr combine gr1.gph gr3.gph, row(2)
            [ATTACH=CONFIG]n1622763[/ATTACH]
            This is fantastic! Thank you!

            Comment


            • #7
              Originally posted by Andrew Musau View Post
              The issue is whether you want to align the right hand axis of figure 2 with the left hand axis of figure 1 and the left hand axis of figure 3 with the right hand axis of figure 1. If this does not matter, then just manipulate the sides margins of figure 1 and combine with figure 2 and figure 3.

              Code:
              sysuse auto, clear
              set scheme s1mono
              scatter mpg price, saving(gr1,replace) graphregion(margin(50 50 0 0))
              scatter mpg weight, saving(gr2,replace)
              gr combine gr2.gph gr2.gph, saving(gr3,replace) row(1)
              gr combine gr1.gph gr3.gph, row(2)
              [ATTACH=CONFIG]n1622763[/ATTACH]
              Hi Andrew,
              It seems that under such way, the text of figure 1 is bigger than figure2 and 3, how to make it use absolute size of the text to make sure three figures have the same size of the text of ytitle, xtitle,legend and label?
              Thanks again!

              Comment


              • #8
                Play around with the -scale()- option. 0.7 looks like a good approximation.

                Code:
                sysuse auto, clear
                set scheme s1mono
                scatter mpg price, saving(gr1,replace) graphregion(margin(50 50 0 0)) scale(0.7)
                scatter mpg weight, saving(gr2,replace)
                gr combine gr2.gph gr2.gph, saving(gr3,replace) row(1)
                gr combine gr1.gph gr3.gph, row(2)
                Click image for larger version

Name:	Graph.png
Views:	1
Size:	60.2 KB
ID:	1622838

                Comment


                • #9
                  Originally posted by Andrew Musau View Post
                  Play around with the -scale()- option. 0.7 looks like a good approximation.

                  Code:
                  sysuse auto, clear
                  set scheme s1mono
                  scatter mpg price, saving(gr1,replace) graphregion(margin(50 50 0 0)) scale(0.7)
                  scatter mpg weight, saving(gr2,replace)
                  gr combine gr2.gph gr2.gph, saving(gr3,replace) row(1)
                  gr combine gr1.gph gr3.gph, row(2)
                  [ATTACH=CONFIG]n1622838[/ATTACH]
                  It seems that scale(0.75) is more approximate, although I do not kown how to calculate the exact approximation.

                  Comment


                  • #10
                    Just use your eye test. Approximate is good enough here!

                    Comment


                    • #11
                      Originally posted by Andrew Musau View Post
                      Just use your eye test. Approximate is good enough here!
                      Exactly! Thank you so mcuh, Andrew!

                      Comment

                      Working...
                      X