MATLAB re-position colorbar title

조회 수: 3 (최근 30일)
Kelvin
Kelvin 2015년 10월 5일
편집: Kelvin 2015년 10월 6일
I would like to reposition the colorbar title (NOT the colorbar). I try to use the following code:
cb = colorbar; set(get(cb,'title'),'string','Dislocation Density(m^{-2})');
lbpos = get(cb,'title'); pos = get (lbpos,'position'); set(lbpos, 'position', pos) ;
I have got three problems, 1. there are four numbers in the vector "pos" and I don't know which number should I modified in order to move the title upward so that it would not overlap the colorbar. 2. I have tried to alter some number in "pos" but whatever I do the title just move down and overlap with the colorbar. 3. In addition, when I try to enlarge the whole graph with the "maximize" button at the upper right corner, the position of the colorbar title also changes. This doesn't happen if I don't try to re-position the colorbar title.
Please help. Thanks a lot.
  댓글 수: 1
Kelvin
Kelvin 2015년 10월 6일
편집: Kelvin 2015년 10월 6일
I tried to use the following:
cb = colorbar; set(get(cb,'title'),'string','Dislocation Density(m^{-2})'); lbpos = get(cb,'title'); set(lbpos,'Units','data'); pos = get (lbpos,'position'); pos(2) = pos(2)-50; set(lbpos, 'position', pos(1:2));
But it still doesn't work. The MATLAB version I use is 2014a.

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by