4.61111

4.6 | 19 ratings Rate this file 166 downloads (last 30 days) File Size: 1.83 KB File ID: #13188

Shade area between two curves

by John Bockstege

 

30 Nov 2006 (Updated 30 Nov 2006)

No BSD License  

Function shades the area between two vectors.

Download Now | Watch this File

File Information
Description

This routine will shade the area of a 2-D plot between two user defined vectors. Simply pass the two vectors, and their corresponding horizontal coordinates, select your fill color and transparency level and viola! You have a figure that is colored in between the two input vectors.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (20)
11 Dec 2006 Francis Hossmeyer

Great! Solves a common problem.

19 Jan 2007 Chris Klink

Works great, but apparently only when datapoint are horizontally organized (one row). If it's a column it doesn't work. You could mention this in the file.

13 Mar 2007 Matthias Brunner

Very nice. Thanks!

01 Aug 2007 Marc Ferrer

Wonderful function.

31 Aug 2007 H W

Exactly what I needed. Thanks for posting!

02 Oct 2007 Luke Taylor

Just what I needed. Thanks!

08 Dec 2007 Housam binous

Great job. Thanks for all.

06 Feb 2008 M H

lovely function but it is removing box around figure as consequence of transparency.

20 Feb 2008 W. H. Brave

Very good file, thank you.

13 Mar 2008 maka mohu

if you make I run the following example, matlab logs me off my user account on SuSe 10.2

for i=1:25
  figure
  % copy the jbfill.m example from the comments here.
  close
end

07 May 2008 Ta M

Thanks, exactly what I needed!
Also thanks to Chris: put data in row vectors!

26 May 2008 W. Johns

Good file, but the colour disappears when I switch to a vertical log scale. How can I fix this?

06 Aug 2008 Yasser Soliman

Great. This was very helpful and saved me lots of time to figure out the exact work that you've done. Thanks!
On another note, I need a few vector-couples the area between which need to be shadded, on the same plot. How can I incorporate that?

05 Sep 2008 Luis Concha

Very, very helpful and extremely easy to use. Great for confidence intervals!

11 Feb 2009 ursula larke

thank you!!!! this came in REALLY handy! easy to use, well documented! :)

06 Apr 2009 Ueli Rutishauser  
07 Apr 2009 Ueli Rutishauser

works great,thanks!
the "transparancy" option comes with a caveat: it will switch the renderer to opengl. After that, a vector export is not possible anymore (matlab limitation). set to 1.0 to avoid this problem.

10 Jun 2009 Andranik Valedi

Beautiful.

04 Oct 2009 bonobo 2000

good but row vectors VS column vectors as input does matter.

18 Nov 2009 SRG  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
specialized John Bockstege 22 Oct 2008 08:50:53
plotting John Bockstege 22 Oct 2008 08:50:53
fill John Bockstege 22 Oct 2008 08:50:53
area John Bockstege 22 Oct 2008 08:50:53
curves John Bockstege 22 Oct 2008 08:50:53
shade John Bockstege 22 Oct 2008 08:50:53
graphics John Bockstege 22 Oct 2008 08:50:53
shading Gautam Vallabha 17 Jun 2009 11:12:02
shade ismail fourari 09 Jul 2009 09:26:01
shading ismail fourari 09 Jul 2009 10:49:55
plotting SRG 18 Nov 2009 16:54:51
graphics SRG 18 Nov 2009 16:54:58
fill SRG 18 Nov 2009 16:55:01
shade SRG 18 Nov 2009 16:55:04
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com