4.83333

4.8 | 6 ratings Rate this file 118 downloads (last 30 days) File Size: 3.37 KB File ID: #14290

cbarf

by M MA

 

15 Mar 2007 (Updated 14 May 2008)

Code covered by BSD License  

Real filled colorbar

Download Now | Watch this File

File Information
Description

Similar to the well known colorbarf but more realistic.

There are two things missing in colorbar and colorbarf:
1. the colorbar ticks are scaled according to the size of each interval.
2. when color is saturated at the upper limit, or when is white, below the lower limit, a triangle is added. The triangle means "more/less than". Such information is not provided by the existing tools, colorbar and colorbarf.
See the examples.

Besides, there is a bug (?) with contourf: in some cases, even with the levels specified, one additional level is added and corrensponds to the sourrounding line! In such case, colorbarf adds one box for this fake level!

Syntax: H=CBARF(DATA,LEVELS,MODE,SCALE)

Updated 13-7-2007 by adding the option SCALE for linear/non linear scale

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
colorbarf

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
04 Jun 2007 Loic Jullion

Great!Exactly what I needed!

19 Jul 2007 Lucio Rezende

grande martinho ! excelente !

02 May 2008 K Kats

I have been thinking about switching to another tool for contour plots, but this neat script saved me! Thank you.

14 May 2008 wu only

Thank u for your work!
but I also find a bug(?) with it.

cbarf(data,lev,'vertical','nonlinear') and
cbarf(data,lev,'vertical','linear') produce different colors according to the same specified levels. The latter one is right.

14 May 2008 M MA

You are right Wu. The bug is now fixed.
Thank you

22 May 2008 Wu Zhiyong

Great work! Thank you!

06 May 2009 Brian Magi

A really useful function for a much better colorbar option. This is probably a simple change, but i don't know enough about handle graphics. When i change the position of the colorbar from cbarf to somewhere in the plot, cbarf is always behind the main plot. I tried changing 'Layer' to top (and the main plot to bottom) but to no avail. if anyone has what is probably a quick solution, i'd appreciate it.

29 Sep 2009 Chamane

great work!

Please login to add a comment or rating.
Updates
17 Jul 2007

Added input argument SCALE for linear/non linear scale

14 May 2008

Corrected colors for the nonlinear case

Tag Activity for this File
Tag Applied By Date/Time
annotation M MA 22 Oct 2008 09:04:36
customization M MA 22 Oct 2008 09:04:36
colorbar M MA 22 Oct 2008 09:04:36
colorbarf M MA 22 Oct 2008 09:04:36
real M MA 22 Oct 2008 09:04:36
realistic M MA 22 Oct 2008 09:04:36
graphics M MA 22 Oct 2008 09:04:36
plot annotation M MA 22 Oct 2008 09:04:36
plot M MA 22 Oct 2008 09:04:36
 

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