Dear Stata-community!
My question is, how can I change the background color of the overall region of a twoway graph? I have a twoway graph which combines a bar and a line graph, furthermore the graphs are plotted for four different income groups. I changed already the plotregion and the graphregion but I have still the light-blue color in the background. I could do this in the graph editor, however, I would like to plot more graphs for different types in a loop and to change each graph in the graph editor is to much work. I think there must be an easier way. I use Stata15. Here is my code:
foreach i of numlist 1/15 {
local label : label(type) `i'
graph twoway (bar No_natural_disasters year if type == `i', ///
sort(year) yaxis(1) fi(inten20)) ///
(line Taff_y_type_GNIG_natdis year if type == `i', ///
sort(year) yaxis(2)) ///
, by(GNIG_cat, ///
title("`label'")) ///
ylabel(,angle(0) axis(2) nogrid) ///
ylabel(,angle(0) axis(1) nogrid ) ///
plotregion( fcolor(white)) ///
graphregion( fcolor(blue)) ///
xlabel(,angle(30)) ///
name(graph_15_`i', replace) ///
legend(label ( 1 "Number natural disasters" ) label (2 "Affected people per natural disaster"))
}
Thanks!
My question is, how can I change the background color of the overall region of a twoway graph? I have a twoway graph which combines a bar and a line graph, furthermore the graphs are plotted for four different income groups. I changed already the plotregion and the graphregion but I have still the light-blue color in the background. I could do this in the graph editor, however, I would like to plot more graphs for different types in a loop and to change each graph in the graph editor is to much work. I think there must be an easier way. I use Stata15. Here is my code:
foreach i of numlist 1/15 {
local label : label(type) `i'
graph twoway (bar No_natural_disasters year if type == `i', ///
sort(year) yaxis(1) fi(inten20)) ///
(line Taff_y_type_GNIG_natdis year if type == `i', ///
sort(year) yaxis(2)) ///
, by(GNIG_cat, ///
title("`label'")) ///
ylabel(,angle(0) axis(2) nogrid) ///
ylabel(,angle(0) axis(1) nogrid ) ///
plotregion( fcolor(white)) ///
graphregion( fcolor(blue)) ///
xlabel(,angle(30)) ///
name(graph_15_`i', replace) ///
legend(label ( 1 "Number natural disasters" ) label (2 "Affected people per natural disaster"))
}
Thanks!
Comment