# Plots: Ribbons along y-axis

**URL:** <https://discourse.julialang.org/t/plots-ribbons-along-y-axis/108100>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [December 27, 2023, 3:23pm UTC](https://discourse.julialang.org/t/plots-ribbons-along-y-axis/108100 "2023-12-27T15:23:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jabru/32/205670_2.png) [@jabru](https://discourse.julialang.org/u/jabru)\
**Post date:** [December 27, 2023, 3:23pm UTC](https://discourse.julialang.org/t/plots-ribbons-along-y-axis/108100/1 "2023-12-27T15:23:16Z")

</div>

Hi there,

I am currently trying to plot my data with a standard deviation. However, due to context reasons, I have a function f(y) instead of f(x). I would now like to make the error look nice with the help of the ribbon attribute. However, the ribbon attribute seems to create the ribbon thickness based on the x-axis. i.e the ribbon seems to be only fit to display a y-error.

For example: I have the following code:

```julia
ydata = [1:10;];
xdata = ydata.^2
xerr=rand(Float64, 10)*10
plot(xdata, ydata, xerr=xerr)

```

which produces the following plot

![errorbars](https://global.discourse-cdn.com/julialang/original/3X/e/b/ebaedf15a1f914e32c6df63080677748d021cdce.png)

What I would like to have is something like this

 ![transparent_ribbon](https://global.discourse-cdn.com/julialang/original/3X/8/0/80f9cd465d9b4f7a839c15bc5f3b44d54ef17673.png)

where the error is represented by a somewhat transparent ribbon. However, instead if the yerror, I would like the xerror to be represented by a ribbon

Is there some way of displaying a x-error using the ribbon attribute of plots?

Thank you in advance!

---

<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:** [December 27, 2023, 9:55pm UTC](https://discourse.julialang.org/t/plots-ribbons-along-y-axis/108100/2 "2023-12-27T21:55:42Z")

</div>

Try this:

```julia
using Plots
y = 1:10
x = y.^2
xerr = 10 * rand(Float64, 10)
xs, ys = [x - xerr; reverse(x + xerr)], [y; reverse(y)]
plot(xs, ys, st=:shape, fc=:blues, lw=0, label=false)
plot!(x, y, xerr=xerr)

```

 ![Plots_gr_vertical_ribbon](https://global.discourse-cdn.com/julialang/original/3X/e/1/e1aba9cade0166f08b6a8829e0d9f1531da5382f.png)

---

<div class="post-metadata">

**Author:** ![jabru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jabru/32/205670_2.png) [@jabru](https://discourse.julialang.org/u/jabru)\
**Post date:** [December 28, 2023, 11:49am UTC](https://discourse.julialang.org/t/plots-ribbons-along-y-axis/108100/3 "2023-12-28T11:49:29Z")

</div>

Thank you so much this is a great answer!
