Created
November 26, 2018 01:13
-
-
Save mattgaidica/78f2b6aa0fd0ba92616fe2a1ce2e3da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cb = cbAside(ax,labelText,cbColor,caxisVals) | |
cbOffset = .001; | |
cb = colorbar(ax,'Location','east'); | |
% % cb.FontSize = 8; | |
gcaPos = ax.Position; | |
cbPos = cb.Position; | |
set(cb,'position',[gcaPos(1) + gcaPos(3) + cbOffset gcaPos(2) cbPos(3)/2 gcaPos(4)]); | |
set(cb,'YAxisLocation','right'); | |
cb.Color = 'r'; | |
if exist('labelText') | |
cb.Label.String = labelText; | |
end | |
if exist('cbColor') | |
cb.Color = cbColor; | |
else | |
cb.Color = 'r'; | |
end | |
if exist('caxisVals') | |
caxis(ax,caxisVals); | |
else | |
if sum(abs(caxis)) > 10 | |
caxis(ax,round(caxis)); | |
end | |
end | |
cb.Ticks = caxis; | |
cb.Box = 'off'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment