View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.4 | 17 ratings Rate this file 43 Downloads (last 30 days) File Size: 78.2 KB File ID: #2683 Version: 1.0
image thumbnail




11 Nov 2002 (Updated )

Extending ERRORBAR, it plots a line within a shaded area, as 'continuous' confidence/error bounds.

Editor's Notes:

This file was a File Exchange Pick of the Week

| Watch this File

File Information

CONFPLOT is a linear plot utility, extending ERRORBAR to represent continuous confidence/error boundaries as a shaded gray area around the plotted line (i.e. taking advantage of the command 'area').
CONFPLOT(X,Y,L,U) plots the graph of vector X vs. vector Y with 'continuous' confidence/error boundaries specified by the vectors L and U. L and U contain the lower and upper error ranges for each point in Y. The vectors X,Y,L and U must all be the same length.


This file inspired Confplot T, Errorfill, Boundedline.M, and Errorshade.

MATLAB release MATLAB 6.0 (R12)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (20)
15 Dec 2016 thalia

thalia (view profile)

much better than errorbar.
Would be cool to be able to specify all the linespecs/parameters than you can using plot

21 Jul 2016 zy z

zy z (view profile)

better than errorbar.

28 Nov 2015 Farhad Sedaghati

13 Jun 2014 Hoi Wong

Hoi Wong (view profile)

Great program. I think the last line should be if(nargout>=1) instead of if(nargout>1).

It seems like the program has at most one output argument. It doesn't make much sense to me to specify two output just to get one out.

In fact, MATLAB throws an exception when I tried to specify an output argument. I guess so far everybody does not need the handles :)

Comment only
14 Dec 2012 Mircea Stoica

12 Jul 2012 Shien Kwun Leong

Thank you.

04 Jul 2012 Neuralex

I'd like to know how I can modify the color of the shade. If I have multiple lines to plot I need different colors for both lines and shades.

Comment only
09 Aug 2011 Panagiotis

It's very useful but there is a conflict with the "legend" command.

22 Mar 2011 Nicolas

Compatible with Laprint.

18 Dec 2010 Nathan Orloff

Hmmm. Well I gave it a five, because it is easy. Now after using it there are a couple major bugs.

1) It does not output any handles, so you cant conveniently change plot details.

2) It does not allow you to pass a color to shade. So you are stuck with the default options. Errorshade2 can do this, but it is not as easy to implement and debug.

Comment only
18 Dec 2010 Nathan Orloff

21 Sep 2010 Jim

Jim (view profile)

I really appreciated this as a starting point, however, like Raymond Reynolds wrote in a comment in 2006, it doesn't do well for overlapping intervals, because you cannot add/control the alpha of the shaded area. An easier, and more useful way to do the plotting is to replace the area with a patch command. This then allows you to directly control the shading and alpha of the area, the only caveat is that you must have bounded ends, so a check to set the first and last points to be the same in the shaded area is needed. I would be happy to send you my code that I edited to do this for you to update this, or (less desirable), I could upload my own version, but I think replacing with patches is a superior method and allows effective viewing of multiple shaded areas.

28 Apr 2009 Kay Thurley

19 Jun 2008 jarek tuszynski

Simple and effective. I seem to be using it a lot.

11 Jun 2008 Maria Byrne

Great! Just what I was looking for. Very tidy way to represent range of values found in noisy data. I used this function and then overlaid errorbar on top.

10 Nov 2006 Raymond Reynolds

Ok, but not sure its very good for multiple plots, which is what i want for comparing overlapping intervals- can't easily control which plots overly others.

01 Dec 2005 Sergio Vallina

confplot.m seems ok in the "default mode" (without defining color and linestyle) but has a bug if we try:

For example,
x = 1:0.1:10;
y = sin(x);
e = std(y)*ones(size(x));

or even it gives an error if we try:


28 Nov 2005 Alberto Redondas

Very useful but dont work if you have NaN on the error variables.

02 Aug 2004 Stefano Fusi

Very useful. I'm not sure it works in a log scale.

12 Nov 2003 Ajit Chaudhari

A nice starting point to figure out how to make the error plots I want

11 Apr 2016 1.0

BSD License update.

Contact us