필터 지우기
필터 지우기

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

조회 수: 8 (최근 30일)
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')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by