フィルターのクリア

Colorbar color range always from 0-1, even when altering limits

23 ビュー (過去 30 日間)
Ida
Ida 2015 年 10 月 13 日
コメント済み: Ida 2015 年 10 月 14 日
Hello, I have a gui in which I display a 2D image and an associated colorbar. When I change the limits of the colorbar, the color range still only goes from 0 to 1, even if I use the limits e.g. -4 to 5 (see attached image for an example). Note that the image is displayed correctly, i.e. within the right range. The colorbar is not however. In the gui, I have an empty axes object called axesColorbar.
handles.colorbar = colorbar(handles.axesColorbar);
set( handles.colorbar, 'Limits',[-1.5 4.5] );
colormap(Jet);
Does anyone know how to fix this? Thank you! Sincerely, Ida

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 13 日
Changing the colorbar limits does not affect the data in the graph.
Either what is being drawn has limits 0 to 1, or else caxis is set to 0 to 1 for the axes.
  1 件のコメント
Ida
Ida 2015 年 10 月 14 日
Hi Walter and thanks for your reply!
Indeed, changing caxis as caxis([lowlim highlim]) did update the colorbar colors as well! thank you!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by