フィルターのクリア

changing text orientation of lcolorbar

72 ビュー (過去 30 日間)
Sukuchha
Sukuchha 2012 年 4 月 16 日
回答済み: Image Analyst 2014 年 8 月 22 日
I want to change the orientation of lcolorbar! I want my text align verticle, i.e i want to rotate texts besides colorbar by 90 degree. How can i do that .
figure;colormap(my_cmap_S)
labels = {'Forest','Water','Agriculture','Green Areas','Built-up'};
lcolorbar(labels,'fontweight','normal', 'fontsize',16);
I = label2rgb(class_image,my_cmap_S);
imshow(I,[]),colormap (my_cmap_S) ;
Where I is my class_image is my classified image with five class . Any suggestions?
  1 件のコメント
Rebecca
Rebecca 2014 年 8 月 22 日
Sukuchha, did you ever figure out how to rotate the colorbar labels? I'm trying to do the same thing in MATLAB right now.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2014 年 8 月 22 日
Try this:
handleToColorBar = colorbar;
set(handleToColorBar,'YTickLabel', []);
hYLabel = ylabel(handleToColorBar, 'Blue Cyan Green Yellow Orange Red');
set(hYLabel,'Rotation',90);
title(handleToColorBar, 'Color Map');

Richard
Richard 2012 年 4 月 16 日
Im not sure if this answers your question but if you want to rotate the text by the colorbar (as noted above):
c = colorbar;
hL = ylabel(c,'title');
set(hL,'Rotation',90);
this will rotate the text which labels the colorbar. P.s. im not sure if your looking for 0 degrees or 90 degrees, in either case, simply change the rotation value.
When you specify moving up! I'm guessing this means moving the label to the top of the colorbar? in this case:
c = colorbar;
hL = title(c,'title');
I hope this answers your question.
  1 件のコメント
Sukuchha
Sukuchha 2012 年 4 月 17 日
Thanks lestyn for taking time to answer my question. But that was not what i meant.
I want to lable colorbar with strings eg.'Forest' for data 1, 'Water' for data 2. lcolorbar allows to do that. But the problem is labels are horizontal and i want to rotate those labels to vertical. Hope i made myself clear.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeColorbar についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by