How to change the colorbar limits in a previously saved fig file

15 ビュー (過去 30 日間)
Ricardo Duarte
Ricardo Duarte 2021 年 10 月 11 日
コメント済み: Ricardo Duarte 2021 年 10 月 14 日
Hello,
I have a figure containing a colorbar that I saved in a .fig format.
Now I need to open it and change the limits of the color bar. Im using
caxis([inferior_limit superior_limit])
.
However, when I do this nothing happens.
What Im doing wrong?
Thank you

採用された回答

Walter Roberson
Walter Roberson 2021 年 10 月 11 日
figfilename = 'AppropriateFile.fig';
fig = openfig(figfilename);
cb = findobj(fig, 'type', 'Colorbar');
cb.Limits = [inferior_limit superior_limit];
After that you might want to save the figure indicates in fig into a new file.
  7 件のコメント
Walter Roberson
Walter Roberson 2021 年 10 月 13 日
imagesc() sets the image 'CDataMapping', 'scaled' . If a non-empty scale range is provided, then it also sets the axes CLim property to that range; if "hold" was off then it also sets the axes CLimMode to 'auto'
This is almost the same calling imagesc() without a range and then calling caxis() yourself; the difference is just in whether CLimMode is set to 'auto' or not (caxis does not set it.)
If you still have your figure up but you want to change the caxis and save again while it is still up, then referring to your previous code,
caxis(ax1, [inferior_limit superior_limit]);
savefig(SPLfigure, 'teste.fig')
Ricardo Duarte
Ricardo Duarte 2021 年 10 月 14 日
Thank you Walter!

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by