Announcement

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

  • Force all x-axis labels to display in a facet plot

    Code:
    graph hbar percentage_disabled, over(age_bracket) by(statefip) bargap(0.5)
    I'm creating an facet plot of horizontal bar graphs displaying disability percentages of the total population within age bins by state. The graph turns out better than you would think when using hbar. However, I would like to tell Stata to display the x-axis for each plot. As it stands, it will only display the x-axis for the state graphs at the bottom. I poured over the relevant documentation and failed to find an appropriate option. Hoping someone has a fix.

    Thanks in advance.

  • #2
    I'm also quite open to other suggestions for visualizing this type of data most effectively or other ways of improving these facet plots if anyone has any. However, hbar does a surprisingly good job displaying the data for all 50 states for each age bracket without it getting too busy.

    Comment


    • #3
      I should have mentioned as well that I mean the x-axis in the hbar plot, which would be the y-axis on a horizontal bar graph. I want to force the percentage axis to be displayed for each state.

      Comment


      • #4
        The horizontal axis is regarded as the y axis with graph hbar. But I didn't find a fix either, even knowing this. I guess you need to change to twoway bar.

        Detail: For poured read pored.

        Comment


        • #5
          Nick is correct that the horizontal axis in graph hbar is a y-axis, which makes it puzzling why the following works:

          Code:
          sysuse census, clear
          graph hbar marriage divorce death, by(region, ixaxes note("") leg(off))
          Click image for larger version

Name:	Graph.png
Views:	1
Size:	14.6 KB
ID:	1744756


          Naturally, I tried including the option -iyaxes- in place of -ixaxes- which did not work.
          Last edited by Andrew Musau; 27 Feb 2024, 06:18.

          Comment

          Working...
          X