I'm wondering if there is a possibility for Latex to display the error bars of a curve or series of data points as a shaded area rather than individual bars on the points; something like this question. I browsed through the pgfplots manual and found nothing of the sorts.

My idea so far is to plot the y-error and y+error as solids and fill the space between both of them, as is done in this other question.

An example of what I mean: the top image has regular error bars, and the bottom image has error bars as a shaded area (done with Python according to this question.

Plot with regular error bars Plot with error bars as shaded area

  • 1
    Instead of just referencing the questions form where you got the ideas, please include also a minimal working example (MWE) showing what you have so far. May 8, 2018 at 15:24
  • Is your error relative (e.g. +/- 10%) or given as a separate column in a table? You can do that with the fillbetween library, plot y+error and y-error as separate plots, use fill between to fill the area between them. May 8, 2018 at 15:26
  • @TorbjørnT. my error is given as a separate column in a table. Is fill between part of a specific package? I searched for it in Miktex's MPM and I found nothing
    – elporsche
    May 8, 2018 at 15:34
  • Oh sorry, it's a library included with pgfplots, see the "Related libraries" part in the pgfplots manual. May 8, 2018 at 15:35

1 Answer 1


A quick example with pgfplots and the fillbetween library:

enter image description here

x y err
0 1 0.1
1 1.5 0.3
2 2 0.2

\addplot table[x=x,y=y] {data.dat};

\addplot [name path=upper,draw=none] table[x=x,y expr=\thisrow{y}+\thisrow{err}] {data.dat};
\addplot [name path=lower,draw=none] table[x=x,y expr=\thisrow{y}-\thisrow{err}] {data.dat};
\addplot [fill=blue!10] fill between[of=upper and lower];

  • Thank you! It turns out that I had a pgfplots manual from 2010 and couldn't find the fill between part in the Related libraries. It blows my mind that now pgfplots can work with units as well.
    – elporsche
    May 8, 2018 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .