Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot/save only the colorbar in Matlab?

Tags:

plot

matlab

How can I plot only a color bar, e.g. jet from -1 to 1, in Matlab? I need to save it as an image.

Running colorbar also plots an empty axis next to the color bar.

like image 773
Tim Avatar asked Sep 11 '25 05:09

Tim


1 Answers

what about this:

colorbar
axis off

EDIT :

If you want to fully control the width and position of the colorbar then you can do something like:

fig1=figure;
left=100; bottom=100 ; width=20 ; height=500;
pos=[left bottom width height];
axis off
colorbar([0.1 0.1  0.7  0.8]);
set(fig1,'OuterPosition',pos) 

enter image description here

like image 126
bla Avatar answered Sep 13 '25 20:09

bla