This sample from a study is very close to what I need. The question is, how do I achieve the conditional background color like in the chart below. This chart has two categories, I have three, so I would use some texture for the third.
The categories for the condition that changes over time are in a vector with names CL, C, and CR.
Here's some sample data. So there's the index and then there's the categories that are government types (center-left, center, center-right). In the data there are 72 government terms so there are 72 consecutive runs, therefore doing it by hand with rects is kind of cumbersome at least. I do understand that first I need to plot the categories and then add the line to the plot, I'll worry about axes after the fact and add them last.
shareindex categ
100 C
103 C
104 C
102 CL
99 CL
98 CR
99 CR
101 CL
104 CL
105 CR
104 CR
102 C
103 C