Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab: add unit above the colorbar

enter image description here

I have a question about how to add a unit above the colorbar. My code as below:

hc=colorbar;
xlabel(hc,'psi');

However, it reveals that unit is not above the colorbar.

like image 950
Jeremy_Tamu Avatar asked Dec 05 '22 16:12

Jeremy_Tamu


2 Answers

Replace xlabel(hc,'psi') by title(hc,'psi'). So the code becomes

hc=colorbar;
title(hc,'psi');

This gives

enter image description here

like image 116
Luis Mendo Avatar answered Jan 08 '23 14:01

Luis Mendo


You can use the code as below

title(colorbar,'psi','FontSize',24);
like image 24
FortranFun Avatar answered Jan 08 '23 16:01

FortranFun