필터 지우기
필터 지우기

Title position below the x axis

조회 수: 381 (최근 30일)
Mahdi Torabi
Mahdi Torabi 2018년 6월 30일
댓글: Mahdi Torabi 2018년 6월 30일
How can I change the position of a title from top of the figure to the below of x axis using code(automatically) on a subplot?

채택된 답변

Shantanu Gontia
Shantanu Gontia 2018년 6월 30일
편집: Shantanu Gontia 2018년 6월 30일
To change the position of the title, you can modify the Position property of the Title in the axes. You can modify the Position property of the Title object to get the desired results. Although, I would recommend first setting the Units property to normalized. In that way you can give Position values relative to the axes.
The Position argument requires 3 inputs, namely, the x,y and z coordinates. In normalized units, 0,0,0 is the left-bottom corner and 1,1,1 is the right-top corner of the axes. You can provide negative value to the y-coordinate in order to push the title below the axes.
plot([1 2 3], [1 2 3]); % Random plot
t = title('Random Plot', 'Units', 'normalized', 'Position', [0.5, -0.1, 0]); % Set Title with correct Position
Although, the example I have given is with the plot, the same applies to subplots as well.
  댓글 수: 1
Mahdi Torabi
Mahdi Torabi 2018년 6월 30일
Thank you for your reply. It was very nice and simple way.

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

추가 답변 (1개)

jonas
jonas 2018년 6월 30일
편집: jonas 2018년 6월 30일
Here are two options that may work for you:
%alter vertical position of title
figure;hold on
subplot(2,1,1)
t=title('Title1')
xlabel('xlabel')
set(t,'position',get(t,'position')-[0 1.4 0])
%add title as part of the xlabel
subplot(2,1,2)
xlabel(['xlabel',newline,'\bf Title2'])
This previous question gives some similar options ( link )
  댓글 수: 1
Mahdi Torabi
Mahdi Torabi 2018년 6월 30일
Thank you very much for your reply. Both methods work well.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by