How to flip x & y axes of a colorbar
Show older comments
I want to put a colorbar in a figure and have the colorbar horizontally span the length of 3 subplots underneath them. How can I do this and have the colorbar values scale horizontally instead of vertically?
myfig=figure;
subplot(1,3,1);
sp1=plot(1,1,'o', 'markersize', 40, 'markerfacecolor', 'b');
set(gca, 'visible', 'off');
subplot(1,3,2);
sp2=plot(1,1,'o', 'markersize', 40, 'markerfacecolor', 'g');
set(gca, 'visible', 'off')
subplot(1,3,3);
sp3=plot(1,1,'o', 'markersize', 40, 'markerfacecolor', 'r');
set(gca, 'visible', 'off')
colbar=colorbar('Position', [.25 .1 .5 .05]);
colormap jet
I know I could set the colorbar to be 'south' of subplot 2, but then it won't be as wide as I want.
Answers (1)
John Trimper
on 30 Oct 2014
Edited: John Trimper
on 30 Oct 2014
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!