I have been trying to figure out how to shade between Gridlines and I couldn't on my own, but found this post that almost has the perfect response except that the spaces between the frame and the first/last points are not shaded, like you can see on the image.
Tried editing the code presented in the webpage but they all led to errors or the shaded box not being visible anymore.
Could anyone indicate a way of accomplishing a full shading between gridlines? Be it from this code or in any other way?
Thank you!
data={{"Mon 23 Jan 2017 12:41 PM",152},{"Mon 23 Jan 2017 12:44 PM",146},{"Mon 23 Jan 2017 6:11 PM",143}, {"Mon 23 Jan 2017 6:14 PM",142},{"Tue 24 Jan 2017 5:47 PM",135},{"Tue 24 Jan 2017 5:51 PM",126}, {"Wed 25 Jan 2017 6:22 PM",129},{"Wed 25 Jan 2017 6:22 PM",109},{"Thu 26 Jan 2017 12:47 PM",137}, {"Thu 26 Jan 2017 12:49 PM",132},{"Thu 26 Jan 2017 6:36 PM",141}};
thePlot = DateListPlot[data, Joined -> True, PlotRange -> {Automatic, {80, 180}},
GridLines -> {None, {60, 85, 100, 140}}, GridLinesStyle -> Directive[Gray, Thin], ImageSize -> 540];
gr = Graphics[{Opacity[.1], Blue, Rectangle @@ Transpose[{First[PlotRange /. AbsoluteOptions[thePlot, PlotRange]], {100, 140}}]}];
Show[thePlot, gr]
PS: I am copying the snippet of code from the post because I am importing the data from a .csv
file.
Show[thePlot, gr, PlotRangePadding -> 0]
? $\endgroup$