Announcement

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

  • Renaming x axis labels with marginsplot


    Hello, I am using the command margins to compute marginal effects in a linear regression with interactions, and want to plot those across time.

    Code:
    reghdfe unit_value i.china_hk_dummy##i.year, absorb(hs8_group##state_group##ym) vce(robust)
    quietly margins 1.china_hk_dummy, dydx(i.year)
    marginsplot, scheme(sj)  xlabel(, angle(90)) ytitle("Marginal effect", size(small)) xtitle("") title("")
    Using the code above, I get this graph, which of course has bad labels


    Click image for larger version

Name:	image_32869.png
Views:	2
Size:	34.9 KB
ID:	1733244

    Is there a way to easily edit those labels without typing it all out as I did?

    Code:
    marginsplot, scheme(sj)  xlabel(1 "2013" 2 "2014" 3 "2015" 4 "2016" 5 "2017" 6 "2018" 7 "2019" 8 "2020" 9 "2021" 10 "2022" 11 "2023") ytitle("Marginal effect", size(small)) xtitle("") title("")
    And even doing that, it somehow messes up the alignment of the labels:

    Click image for larger version

Name:	Graph1.png
Views:	0
Size:	0
ID:	1733250
    Attached Files
    Last edited by Arthur Carvalho Brito; 08 Nov 2023, 17:43.

  • #2
    a

    Comment

    Working...
    X