hello and thanks in advance for the help.
I am having some issues in setting the xlabel option in a two-way graph. Specifically, i have a dataset whereby i would like to plot a numerical variable (y-axis) against a date variable (x-axis) at quarterly frequency. The sample period goes from 1972q1 until 2020q2. I would like to set a label for the x graph that plots dates every 4 years (so 16 quarters). For example, 1972q1, 1976q1 and so on.
this is the code that i'm using:
* Plot
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 legend_US `legend_sw'
local fc_xlabel_US xlabel(1972q1(16)2020q1)
bgshade date, shaders(recessions) ///
twoway ((line dCAPGMFA date, lcolor(black) lpattern(solid) lwidth(thick)), `fc_xlabel_US' ///
`options' `legend_`US'')
graph export "$export_directory\capacity_level_US.eps", replace
However, I do receive the error:
invalid label specifier, : 1972q1(16)2020q1:
r(198);
The variable date has already a format %tq.
I am having some issues in setting the xlabel option in a two-way graph. Specifically, i have a dataset whereby i would like to plot a numerical variable (y-axis) against a date variable (x-axis) at quarterly frequency. The sample period goes from 1972q1 until 2020q2. I would like to set a label for the x graph that plots dates every 4 years (so 16 quarters). For example, 1972q1, 1976q1 and so on.
this is the code that i'm using:
* Plot
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 legend_US `legend_sw'
local fc_xlabel_US xlabel(1972q1(16)2020q1)
bgshade date, shaders(recessions) ///
twoway ((line dCAPGMFA date, lcolor(black) lpattern(solid) lwidth(thick)), `fc_xlabel_US' ///
`options' `legend_`US'')
graph export "$export_directory\capacity_level_US.eps", replace
However, I do receive the error:
invalid label specifier, : 1972q1(16)2020q1:
r(198);
The variable date has already a format %tq.
Comment