Code covered by the BSD License  

Highlights from
plot_colorbar

3.5

3.5 | 4 ratings Rate this file 12 Downloads (last 30 days) File Size: 1.81 KB File ID: #19591
image thumbnail

plot_colorbar

by Matthew Foster

 

15 Apr 2008 (Updated 15 Apr 2008)

Plot a colorbar as a figure for publication.

| Watch this File

File Information
Description

Plots a vertical or horizontal colorbar for inclusion in a publication. The specified colorbar can be plotted either horizontally or vertically, and a function handle can be passed in to allow the use of different colormaps.

Written during some recent work, and then cleaned up and published here in case it's useful to anyone else.

Examples:
h1 = plot_colorbar([100, 5], 'h', 'Test Colormap')
h2 = plot_colorbar([150, 10], 'v', 'Test Colormap', @hsv)

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
06 Jul 2008 Jean-Christophe OLIVIER

thank you to have thought there. This is a very good idea and very useful!

13 Nov 2008 Martin Ohmes

Addition of a way to modify the ticks to a user defined limit would be helpful. Thanks - just what I was needing.

19 Nov 2010 Matthias Pospiech

does not work for me: It requires an axis handle
map = colormap(axishandle, cmap(dims(1)));

and since it can not be used as an exact replacement of the orignal colormap I can not use without rewriting most of my and of this plugins code

24 Jul 2011 Matthew

I was able to get my desired result (scale from [0 8]) by changing one the lines to set(gca, 'yticklabel', [0, ticks/10]); and then running the program with the limit 80.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
specialized Matthew Foster 22 Oct 2008 09:57:57
plotting Matthew Foster 22 Oct 2008 09:57:57
plot Matthew Foster 22 Oct 2008 09:57:57
colorbar Matthew Foster 22 Oct 2008 09:57:57
figure Matthew Foster 22 Oct 2008 09:57:57
colormap Matthew Foster 22 Oct 2008 09:57:57

Contact us at files@mathworks.com