Matlab - plot window arrangement
Asked Answered
F

2

5

Is there a possibility of building a plot window with 8 plot figures disposed in the following manner?

  • six of them positioned in a 2 x 3 grid;
  • the remaining 2, position in a 1 x 2 grid, underneath the 2 x 3 grid;

I can't use the subplot function, because for the fist 6 I would have subplot(2, 3, x) and for the last 2 I would have subplot(1, 2, x).

Flux answered 30/7, 2011 at 15:19 Comment(0)
K
11

The last input to the subplot command need not be an integer and takes decimal offsets. You can use this to create the plot you want, with the two lowest ones centered under the row above with all figures being the same size as in the following example.

figure(1)
subplot(3,3,1)
subplot(3,3,2)
subplot(3,3,3)
subplot(3,3,4)
subplot(3,3,5)
subplot(3,3,6)
subplot(3,3,7.5)
subplot(3,3,8.5)

enter image description here

Kiri answered 30/7, 2011 at 16:24 Comment(1)
+1 thanks yoda, I did not know you can pass fractions to subplotBenghazi
B
7

Here is an example:

figure
subplot(3,3,1), text(0.5,0.5,'1', 'FontSize',20)
subplot(3,3,2), text(0.5,0.5,'2', 'FontSize',20)
subplot(3,3,3), text(0.5,0.5,'3', 'FontSize',20)
subplot(3,3,4), text(0.5,0.5,'4', 'FontSize',20)
subplot(3,3,5), text(0.5,0.5,'5', 'FontSize',20)
subplot(3,3,6), text(0.5,0.5,'6', 'FontSize',20)
subplot(3,2,5), text(0.5,0.5,'7', 'FontSize',20)
subplot(3,2,6), text(0.5,0.5,'8', 'FontSize',20)

enter image description here

Benghazi answered 30/7, 2011 at 15:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.