How to plot alternating background colors with Plots.jl


I want to plot a time series but visualize a few segments with different background colors.

My idea of the code would be something like plot([1:4 5:8], [rand(4) rand(4)], bg_inside = [:darkblue :red]), but that selects only the first background and ignores the second.

Does anyone have a way for doing that?


Asked the question too quickly. I think I got a solution hehe

plot([1:4 5:8], [ones(4) ones(4)], fillrange = 0, fillalpha = 0.2, linewidth = 0, label = "", c = [:blue :orange])