Hi. I 've tried to draw 4x6 subplots in 1 figure. But the problem is ...
When I execute code
======================================================================
pos1 = [0.025 0.68 0.14 0.17];
subplot(4,6,1 , 'Position', pos1)
pos2 = [0.19 0.68 0.14 0.17];
subplot(4,6,2 , 'Position', pos2)
pos3 = [0.35 0.68 0.14 0.17];
subplot(4,6,3 , 'Position', pos3)
pos4 = [0.51 0.68 0.14 0.17];
subplot(4,6,4 , 'Position', pos4)
pos5 = [0.68 0.68 0.14 0.17];
subplot(4,6,5 , 'Position', pos5)
pos6 = [0.85 0.68 0.14 0.17];
subplot(4,6,6 , 'Position', pos6)
======================================================================
What I want is draw 6 subplots in line. But there are only 5 subplots(1,2,3,4,6). 5th subplot is omitted.
So When I entered the 5th subplot code through the command window, 6 subplots were drawn.
Why 5th subplot is omitted when I run the code?

답변 (1개)

Sourabh
Sourabh 2025년 1월 31일
편집: Sourabh 2025년 1월 31일

0 개 추천

I too encountered this issue in MATLAB R2020a and there are two ways to solve this issue either by using only the auto grid axes positioning or by using only custom positions. Kindly follow the steps given below:
  1. Auto grid axes positioning
Use the syntax:
subplot(m,n,p)
For example:
subplot(4,6,1)
subplot(4,6,2)
subplot(4,6,3)
subplot(4,6,4)
subplot(4,6,5)
subplot(4,6,6)
2. Custom positions
Use the syntax:
subplot('Position',pos)
For example:
pos1 = [0.025 0.68 0.14 0.17];
subplot('Position', pos1)
pos2 = [0.19 0.68 0.14 0.17];
subplot('Position', pos2)
pos3 = [0.35 0.68 0.14 0.17];
subplot('Position', pos3)
pos4 = [0.51 0.68 0.14 0.17];
subplot('Position', pos4)
pos5 = [0.68 0.68 0.14 0.17];
subplot('Position', pos5)
pos6 = [0.85 0.68 0.14 0.17];
subplot('Position', pos6)
Kindly refer the following MATLAB documentation for “subplot”:

카테고리

제품

태그

질문:

2020년 11월 3일

편집:

2025년 1월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by