MATLAB Answers

Put label in colorbar

908 views (last 30 days)
Ting-Yu Chueh
Ting-Yu Chueh on 18 Sep 2019
Edited: 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.

Accepted Answer

Adam
Adam on 18 Sep 2019
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
Ting-Yu Chueh on 18 Sep 2019
Adam, it works perferct. Thanks!

Sign in to comment.

More Answers (1)

Ruger28
Ruger28 on 18 Sep 2019
From
doc colorbar
try
a = colorbar;
a.Label.String = 'Power (dB)';

  1 Comment

Ting-Yu Chueh
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.


Translated by