Hi,
I've plotted the two-way graph with the xline to show the crisis period.
I would like to add xline into the legend as well
my code:

Now, legend only show dash line (oil price) and black line (oil price return). I'm wondering how can the xline (blue color) into the legend?
Thank you
I've plotted the two-way graph with the xline to show the crisis period.
I would like to add xline into the legend as well
my code:
Code:
twoway (line wti date, yaxis(1) fc(gs10) lc(gs10) lpattern(shortdash)) || (line netwti date, yaxis(2) fc(black) lc(black)) /// if tin(01011988,01122019), title("") ytitle("Oil price (USD)", axis(1) size(small)) ytitle("Oil price return (%)", axis(2) size(small)) /// xline(11170 11201 11231 11262 11292, lwidth(thick) lc(ltblue)) /// xline(13849 13880 13911 13939 13970 14031 14092 14153 14214, lwidth(thick) lc(ltblue)) /// xline(15249 , lwidth(thick) lc(ltblue)) /// 9-11 xline(15645 15675 15706 15737 , lwidth(thick) lc(ltblue)) /// Iraq war xline(17745 17806 17867 17898 , lwidth(thick) lc(ltblue)) /// xline(18659 18718 , lwidth(thick) lc(ltblue)) /// xline(19905 19936 19997 20058 20089 , lwidth(thick) lc(ltblue)) /// ylabel(,labsize(vsmall)) ylabel(,labsize(vsmall) axis(2)) xlabel(,labsize(vsmall)) xtitle("") /// graphregion(fcolor(white)) subtitle(,lcolor(white) color(black)) legend( label (1 "Oil price") label (2 "Oil price return") size(small) region(col(white))) xlabel(#15,grid) ylabel(, nogrid) /// tlabel(, format(%tdCY)) ylabel(15(15)140) ylabel(-40(10)40, axis(2))
Now, legend only show dash line (oil price) and black line (oil price return). I'm wondering how can the xline (blue color) into the legend?
Thank you
Comment