Hello and thanks for the help.
I am using this code to generate the 5 attached charts:
* Set some global options for graphs (recessions, country names...)
global countries_europe_EA `" "DE" "ES" "FR" "IT" "EA" "'
global name_DE "Germany"
global name_ES "Spain"
global name_FR "France"
global name_IT "Italy"
global name_EA "Euro Area"
* Label horizontal axis
global xlabel_DE xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_ES xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_FR xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_IT xlabel(`=tq(1995q1)' (12) `=tq(2019q4)', format(%tqCY) nogrid)
global xlabel_EA xlabel(`=tq(1995q1)' (12) `=tq(2019q4)', format(%tqCY) nogrid)
* Legend
global legend_DE legend(bplacement(nw))
global legend_ES legend(bplacement(sw))
global legend_FR legend(bplacement(nw))
global legend_IT legend(bplacement(sw))
global legend_EA legend(bplacement(nw))
foreach c of global countries_europe_EA {
gen recession_`c' = recessions if country == "`c'"
bgshade date, shaders(recession_`c') sstyle(lc(gs14) lpattern(solid)) ///
twoway ((line Z_Solow date, lcolor(black) lpattern(shortdash) lwidth(thick)) ///
(line Z_tv date, lcolor(lime%100*0.8) lpattern(solid) lwidth(thick)) if country == "`c'", ///
graphregion(color(white)) bgcolor(white) xtitle(Year) ytitle("Cumulated Growth (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_`c'} title("{bf:${name_`c'}}") ${xlabel_`c'} ///
legend(label(2 "Our series") label(1 "Solow") cols(1) ring(0) region(margin(zero) color(none))))
graph export "$export_directory/tfplevels_`c'.eps", replace
drop recession_`c'
}
After running this code, I am able to generate the graphs (you can see them from the screenshot). However, there are some options that seem not working properly.
The location of the legend does not work, since the legend is always shown on the righten part of the graph, not sw or nw
The charts for Germany, Spain and France show a 2 at the end of the x-axis. However, there should not be any number, since the graph should stop at 2020q4.
Lastly, the content of the legend is not correct, since it shows BFK instead of Our series.
I am using this code to generate the 5 attached charts:
* Set some global options for graphs (recessions, country names...)
global countries_europe_EA `" "DE" "ES" "FR" "IT" "EA" "'
global name_DE "Germany"
global name_ES "Spain"
global name_FR "France"
global name_IT "Italy"
global name_EA "Euro Area"
* Label horizontal axis
global xlabel_DE xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_ES xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_FR xlabel(`=tq(1995q1)' (12) `=tq(2020q4)', format(%tqCY) nogrid)
global xlabel_IT xlabel(`=tq(1995q1)' (12) `=tq(2019q4)', format(%tqCY) nogrid)
global xlabel_EA xlabel(`=tq(1995q1)' (12) `=tq(2019q4)', format(%tqCY) nogrid)
* Legend
global legend_DE legend(bplacement(nw))
global legend_ES legend(bplacement(sw))
global legend_FR legend(bplacement(nw))
global legend_IT legend(bplacement(sw))
global legend_EA legend(bplacement(nw))
foreach c of global countries_europe_EA {
gen recession_`c' = recessions if country == "`c'"
bgshade date, shaders(recession_`c') sstyle(lc(gs14) lpattern(solid)) ///
twoway ((line Z_Solow date, lcolor(black) lpattern(shortdash) lwidth(thick)) ///
(line Z_tv date, lcolor(lime%100*0.8) lpattern(solid) lwidth(thick)) if country == "`c'", ///
graphregion(color(white)) bgcolor(white) xtitle(Year) ytitle("Cumulated Growth (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_`c'} title("{bf:${name_`c'}}") ${xlabel_`c'} ///
legend(label(2 "Our series") label(1 "Solow") cols(1) ring(0) region(margin(zero) color(none))))
graph export "$export_directory/tfplevels_`c'.eps", replace
drop recession_`c'
}
After running this code, I am able to generate the graphs (you can see them from the screenshot). However, there are some options that seem not working properly.
The location of the legend does not work, since the legend is always shown on the righten part of the graph, not sw or nw
The charts for Germany, Spain and France show a 2 at the end of the x-axis. However, there should not be any number, since the graph should stop at 2020q4.
Lastly, the content of the legend is not correct, since it shows BFK instead of Our series.
Comment