필터 지우기
필터 지우기

How to keep colorbar without changing the figure size?

조회 수: 6 (최근 30일)
Osama Tabbakh
Osama Tabbakh 2019년 4월 29일
댓글: Osama Tabbakh 2019년 4월 30일
Hallo,
I have 2 figures. One of them should be figured with colorbar and another one without. But they have the same scale. The problem is, that when I figured the colorbar with the first one the size of the figure will be changed. Any idea how I can fix this?

채택된 답변

Erivelton Gualter
Erivelton Gualter 2019년 4월 29일
You can set the desired size of the figure. For example:
figure(1); % Figure 1 with out colorbar
surf(peaks);
% Get Position of the figure 1
pos = get(gcf, 'Position'); % gives x left, y bottom, width, height
x = pos(1); y = pos(2); w = pos(3); h = pos(4);
figure(2); % Figure 2 with colorbar
surf(peaks);
colorbar;
% Set Position with desired width w_new = w*1.1
set(gcf, 'Position', [x, y, w*1.1, h])
Then, you can adjust according to your wishes.
  댓글 수: 1
Osama Tabbakh
Osama Tabbakh 2019년 4월 30일
Thank you very much Erivelton, but it still difficult because they will be not exactly identical. But It works thanks.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by