# Shade area under the curve between two points in Plots.jl

**URL:** <https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190>\
**Category:** General Usage\
**Tags:** question, plotting, plots\
**Created:** [February 10, 2022, 7:50pm UTC](https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190 "2022-02-10T19:50:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [February 10, 2022, 7:50pm UTC](https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190/1 "2022-02-10T19:50:40Z")

</div>

Hi all,

I was wondering if it is possible to shade the area under the curve in Plots.jl? For example, can I adapt the code below to shade the area between -1 and 1?

Thanks!

```julia
using Plots, Distributions

x = range(-3, 3, length=100)

y = pdf.(Normal(0,1), x)

plot(x, y, grid=false)

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 10, 2022, 9:07pm UTC](https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190/2 "2022-02-10T21:07:56Z")

</div>

```julia
ix = abs.(x) .< 1
plot(x[ix], y[ix], fillrange = zero(x[ix]), fc=:blues)
plot!(x, y, grid=false, lc=:black, widen=false)

```

 ![Plots_gr_area_under_curve](https://global.discourse-cdn.com/julialang/original/3X/6/9/69bbd427e6784e56b1e77485151aef7c6cd89136.png)

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [February 10, 2022, 9:12pm UTC](https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190/3 "2022-02-10T21:12:39Z")

</div>

I feel like I owe you a beer at this point. Thanks!

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 10, 2022, 9:31pm UTC](https://discourse.julialang.org/t/shade-area-under-the-curve-between-two-points-in-plots-jl/76190/4 "2022-02-10T21:31:19Z")

</div>

We should buy a round of drinks to the creators of Plots.jl
