Announcement

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

  • xlabel option of a two-way graph

    hello and thanks in advance,

    i have an issue with the display of the x-axis containing the date variable. I have a dataset at quarterly level, but i would like to display on the x-axis only the years and not the years with the quarters, as shown in the picture.
    Click image for larger version

Name:	Screenshot 2024-04-18 130950.png
Views:	1
Size:	102.9 KB
ID:	1750437

    this is the relative stata code.

    local options graphregion(color(white)) bgcolor(white) xtitle(Year) ytitle("Growth rate (log changes)") ///
    xscale(titlegap(0) outergap(0)lwidth(medthin) lcolor(black)) yscale(titlegap(1) outergap(0) lwidth(medthin) lcolor(black)) ///
    ylabel(, nogrid) xtick(,tlcolor(black) tlwidth(medthin)) ytick(,tlcolor(black) tlwidth(medthin)) ///
    legend( label(1 "Manufacturing Capacity") cols(1) ring(0) region(margin(zero) color(none)))

    local legend_sw legend(bplacement(sw))
    local fc_legend_DE `legend_sw'
    local fc_xlabel_DE xlabel(`=tq(1996q1)' (16) `=tq(2018q1)', nogrid)

    * Plot
    bgshade date, shaders(recessions) ///
    sstyle(lc(gs14) lpattern(solid)) ///
    twoway ((line d_Y_FC date, lcolor(black) lpattern(solid) lwidth(thick)), `options' `fc_legend_DE' `fc_xlabel_DE')
    graph export "$export_directory\capacity_level_DE.eps", replace



  • #2
    I think you need to explain bgshade here (FAQ Advice #12). Otherwise see https://www.stata-journal.com/articl...article=gr0030 which is focused on your question.

    Comment

    Working...
    X