Can't delete colorbar label

36 ビュー (過去 30 日間)
Ian Harris
Ian Harris 2013 年 2 月 21 日
回答済み: Seyyed Saleh Hosseini 2019 年 11 月 23 日
I have a plot with a horizontal colorbar. The range of values are all very small, so the default labelling uses expotential numbering, with 'x 10^-3' under the bottom right-hand corner of the axes:
I use get and set to replace the X Tick Labels with regular short numbers, ie, -0.005, 0, 0.005, 0.01, 0.015, 0.02, 0.025. However, the 'x 10^-3' text remains, and I can't delete it.
The text appears to be an Annotation, associated with the an object referred from the colorbar's 'XLabel' parameter (hg.Annotation). Nothing I've found in the help systems will allow me to get rid of this label, and I need to! I've tried deleting it.
Has anyone managed this trick? Any help gratefully received..
  3 件のコメント
Ian Harris
Ian Harris 2013 年 2 月 21 日
編集済み: Ian Harris 2013 年 2 月 21 日
Hi Sean, cheers for the fast response. I've tried deleting it, that seems to have no effect:
cb = colorbar('NorthOutside');
cbt = get(cb,'XTick')';
set(cb,'XTickLabel',num2str(cbt));
xlh = get(cb,'XLabel');
delete(xlh);
I've also tried setting 'XLabel' to another handle (the one I found in 'YLabel', for instance - that doesn't happen. I think it's read-only?
Perhaps I need a way to make it vulnerable..
Ian Harris
Ian Harris 2013 年 2 月 21 日
Gah! Sorry - I just tried printing it and the unwanted exponent is gone! It's there on the screen but obviously isn't being swept up when I reassign the text labels.
Apologies for timewasting.. I trusted the graphics, I can't believe it! :)

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

採用された回答

Seyyed Saleh Hosseini
Seyyed Saleh Hosseini 2019 年 11 月 23 日
I think the following trick works:
c.Ticks=[]

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by