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
回答者: Adam
2019 年 9 月 18 日
 採用された回答

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 2019 年 9 月 18 日
Adam, it works perferct. Thanks!

Sign in to comment.


Ruger28
回答者: Ruger28
2019 年 9 月 18 日

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

  1 Comment

Ting-Yu Chueh 2019 年 9 月 18 日
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.