MATLAB Answers

0

Put label in colorbar

Asked by Ting-Yu Chueh on 18 Sep 2019
Latest activity Edited by Ting-Yu Chueh on 18 Sep 2019
I put the label ('Power (dB') in my color bar, and the code is below:
a=colorbar;
ylabel(a,'Power (db)','FontSize',16,'Rotation',270);
However, the label is too close the colorbar (see the figure).
Can anyone help me? Thanks!
Also, how can I to put the different title for each subplot.

  0 Comments

Sign in to comment.

2 Answers

Adam
Answer by Adam
on 18 Sep 2019
 Accepted Answer

The label object should have a position that you can edit. The rotation of 270 rather than 90 moves it inside the tick labels for some reason, but you can edit e.g.
hColourbar.Label.Position(1) = 3;
to change the x position of the label.

  1 Comment

Ting-Yu Chueh on 18 Sep 2019
Adam, it works perferct. Thanks!

Sign in to comment.


Ruger28
Answer by Ruger28
on 18 Sep 2019

From
doc colorbar
try
a = colorbar;
a.Label.String = 'Power (dB)';

  1 Comment

Ting-Yu Chueh on 18 Sep 2019
JR, thanks.
But, I prefer to revrese the orientation of label, which rotate 270 degree, and with more space between unit and lable.

Sign in to comment.