Announcement

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

  • How to label x axis on first row of multi-row histogram

    Dear Stata Users,

    After consulting the histogram and graphing documentation, I was unable to find a solution to this.

    I am creating a 2 x 2 histogram but the X axis label is only showing for the histograms on the second row. Is there any option to get the first row axis to be labeled as well?

    Thanks

    This is the code I am running:

    Code:
    histogram f9003_1,  discrete  by(training_arm, title("Helpfulness in Despute Resolution by Treatment Arm")) gap(40) xlabel(0 1, valuelabel)


    Click image for larger version

Name:	stata.JPG
Views:	1
Size:	108.9 KB
ID:	1583568

  • #2
    This may help


    Code:
    clear
    set obs 100
    set seed 2803
    
    gen x = runiformint(1, 4)
    
    gen y = runiform() > 0.7
    
    histogram y, by(x) xla(0 1) barw(0.7)
    
    histogram y, by(x, xrescale) xla(0 1) barw(0.7)
    Last edited by Nick Cox; 26 Nov 2020, 15:11.

    Comment


    • #3
      Code:
      by(training_arm, ixaxes)

      Comment


      • #4
        Thank you Andrew and Nick!

        Your suggestions both work though I used Andrew's since it involved adding only one term.

        Comment

        Working...
        X