Announcement

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

  • Placing a graph next to others

    Hi,

    I use the following code:
    Code:
    hist dob , by(CW2) note("Fstat=814.39")) frequency ylabel(,nogrid) xlabel(0(5)30, grid gstyle(dot) glcolor(red)) bin(31) start(1) scheme(tab2) name(graph1, replace)
    and get the following histograms:
    Graph 1 -random hist.png



    Then, I plot the histogram for the same data, without the by option to get the histogram for the totality of the data:
    Code:
    hist dob ,   frequency ylabel(,nogrid) xlabel(0(5)30, grid gstyle(dot) glcolor(red)) bin(31) start(1) scheme(tab2)
    Graph 1 -random hist.png

    My question is the following:
    How can I place the latest histogram in the blank space on the third row in the first figure?

    Kind regards,
    Neg
    Last edited by Neg Kha; 09 Aug 2023, 07:36.

  • #2
    Does anyone know the answer to this question?

    Best,
    Neg

    Comment


    • #3
      See https://journals.sagepub.com/doi/pdf...867X1401400117 for one kind of trick.

      The data look very strange!

      Comment


      • #4
        Expanding the data is another way if specifying the width instead of number of bins.

        Code:
        sysuse census, clear
        gen mar000= int(marriage/1000)
        set scheme s1mono
        tw hist mar000, by(region, note("") col(3)) ysc(r(0 40)) width(50) freq xtitle("") saving(gr1, replace)
        expand 2, g(new)
        replace region= 5 if new
        lab def cenreg 5 "All Regions", modify
        hist mar000, by(region, note("") col(3)) freq xtitle("") width(50) saving(gr2, replace)
        gr combine gr1.gph gr2.gph, xcommon ycommon
        Res.:

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	16.9 KB
ID:	1723726

        Comment


        • #5
          Nice trick! Works out great. Thank you both!

          Comment

          Working...
          X