필터 지우기
필터 지우기

Make subplot span across multiple slots

조회 수: 146 (최근 30일)
fKuns
fKuns 2015년 10월 11일
댓글: wagenaartje 2021년 4월 9일
assume a figure split as a 4x3 grid,
+-+-+-+-+
| | | | |
+-+-+-+-+
| | | | |
+-+-+-+-+
| | | | |
+-+-+-+-+
I would like to display 6 plots in a single image, 2 big ones and 4 small ones, in the following way
  • Plot A should take the 4 leftmost, topmost cells
  • Plot B should take the 4 rightmost, topmost cells
  • Plots C, D, E, f should take the 4 last cells
+-+-+-+-+
|A|A|B|B|
+-+-+-+-+
|A|A|B|B|
+-+-+-+-+
|C|D|E|F|
+-+-+-+-+
I know it is possible to have a plot span on multiple columns in a single row, but is it possible to make it span multiple rows?

채택된 답변

dpb
dpb 2015년 10월 11일
Sure, just save a handle as there's not a unique number for any of 'em if do it this way...as long as you don't overwrite an existing grid location numer accidentally, you should be ok--
>> p(1)=subplot(3,4,[1 2 5 6]);
>> p(2)=subplot(3,4,[3 4 7 8]);
>> p(3)=subplot(3,4,[9 10]);
>> p(4)=subplot(3,4,[11 12])
p =
173.0068 174.0068 175.0068 176.0068
>>
  댓글 수: 1
wagenaartje
wagenaartje 2021년 4월 9일
This works, but sometimes this messes up the axes labels...

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2015년 10월 11일
Yes. subplot(4,4,[1 2 5 6])

Muhammad RSMY
Muhammad RSMY 2017년 7월 18일
Hi friends..
how to code to display all subplots in one figure for mm and nn for example: mm and nn are 5*5 or 6*4.. whatever.. its possible to make general code, whatever mm and nn is, should subplot accordingly.
5*5=25 subplots 6*4=24 subplots.. etc
in normal way..i know we code as plot(1,1); subplot(5,5,1) ..
I hope someone can help me to generate code as general cause I am dealing with more data's with different mm and nn
thanks in advance
  댓글 수: 2
Rick
Rick 2018년 2월 23일
try subplot(m, n, 1)
dpb
dpb 2018년 2월 24일
As Rick shows, you can use variables in the argument to subplot; your task is to compute what M,N you want for a given number of total plots; if the choices are just between 24 and 25, it's pretty-much a no-brainer.

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

카테고리

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