Dear list members,

I have a question on the placement of shaded areas in graphs. I had a look at SJ articles and topics, but haven't been able to solve the problem.

I have many graphs of the following type, generated via loops from a panel of cluster-years with binary indicators for notable years, which I use to create shaded areas with bars (extract from loop):

Code:
tw bar curfew_any year , yaxis(2) ylabel(none, ax(2)) yscale(ax(2) alt lcolor(bg) lwidth(none)) plotregion(margin(0)) col(gs14) ///
|| line cdr year , sort yaxis(1) yscale(ax(1) alt) by(district, iy ix)
The problem with this solution is that, while I do want to show the time trend in the levels of the plotted variable -hence the line graphs- I would really like to shade the changes between the levels -not the levels themselves. In other words, I would like the shaded areas to be all shifted leftwards to coincide with the first data point they encounter.

Given that the bar approach shades an area horizontally centered on the data point, and I know of no ways to change that, I guess the only way to shade areas between pairs of dates is to abandon the bar approach in favor of the recast(area) approach. Is it? My feeling is that, still working with bars, subdividing the timevar and plotting observations selectively (still only one per year for the line graph) can alleviate but not entirely solve the problem - at least without creating something like a cluster-days panel, which I would like to avoid. I would be very happy to be proved wrong on this, because the bar approach demands literally no change to my data structure - indeed, not even the dummy variable had to be created for purpose. On the other hand, I don't see any way to automatize the production of those graphs using the recast(area) approach to shading, given that there are many such graphs, and that the shading in them will have to be specific, with multiple intervals of varying length - which I guess would again require substantially altering the panel, perhaps in a way that actually prevents generating these line graphs. So I guess the question is: is there a way to do what I want without substantially altering my data structure?

Many thanks in advance

Array