# How to plot alternating background colors with Plots.jl

**URL:** <https://discourse.julialang.org/t/how-to-plot-alternating-background-colors-with-plots-jl/63548>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [June 25, 2021, 12:57pm UTC](https://discourse.julialang.org/t/how-to-plot-alternating-background-colors-with-plots-jl/63548 "2021-06-25T12:57:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaslusimoes](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kaslusimoes](https://discourse.julialang.org/u/kaslusimoes)\
**Post date:** [June 25, 2021, 12:57pm UTC](https://discourse.julialang.org/t/how-to-plot-alternating-background-colors-with-plots-jl/63548/1 "2021-06-25T12:57:05Z")

</div>

Hi,

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?

Thanks

---

<div class="post-metadata">

**Author:** ![kaslusimoes](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kaslusimoes](https://discourse.julialang.org/u/kaslusimoes)\
**Post date:** [June 25, 2021, 1:01pm UTC](https://discourse.julialang.org/t/how-to-plot-alternating-background-colors-with-plots-jl/63548/2 "2021-06-25T13:01:07Z")

</div>

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])`
