Announcement

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

  • how to make year-quarter labels at the x-axis

    Hi all,

    I deeply need everyone's help as I am inputting this graph into my thesis!

    Below is my sample code:
    Code:
    xtset household date_q
    
    preserve
        keep if income == 0
    
        reghdfe household_emotion i.date_q#c.treat, absorb(i.county#i.date_q) vce(cluster household) 
        
        estimates store D
    restore
    
    preserve
        keep if income == 1
    
        reghdfe household_emotion i.date_q#c.treat, absorb(i.county#i.date_q) vce(cluster household)     
        
        estimates store E
    restore
    
    
    coefplot(D, label(<100k USD) pstyle(p3)) ///
           (E, label(>=100k USD)  pstyle(p4)), keep(*.date_q#c.treat) ///
           rename(#c.treat = \1, regex) ///
           coeflabels(, labsize(tiny)) ///
           drop(_cons) yline(39) ttext(-4500 5 "-1", size(2)) level(95) ///
           xtitle("coefficients") ytitle("2017q1-2020q4_income") graphregion(color(white)) bgcolor(white)
    Based on the above code, my graph depicts two trends with the y-axis as the year-quarter (i.e., the variable date_q) and x-axis as the coefficient value. However, now I am requested to swap the x-axis and y-axis so that the trends in the graph are more readable to the public. It does not have to show all the date_q, so it can be 2017q4, 2018q4, 2019q4, etc., marking every four quarters. Is there any way that I can do with this coefplot since it can store my regression results? Or else, I welcome any other kinds of stata methods so long as it can achieve my task.

    I sincerely appreciate your assistance, as it is in a hurry! Thank you!

  • #2
    Providing a reproducible example is the surest way to get a timely and helpful response. Claims of urgency do not carry significant weight (refer to FAQ Advice #5). Note that coefplot is from SSC (FAQ Advice #12).

    Comment


    • #3
      Cross-posted at https://stackoverflow.com/questions/...-axis-in-stata

      Andrew Musau gave excellent advice. The lack of a reproducible example is also inhibiting replies on SO.

      Comment

      Working...
      X