3 on top, 2 on bottom subplot
27 views (last 30 days)
Show older comments
Hi --
I'd like to create a subplot with two rows - three on the top row and two on the bottom row. I'd like the two on the bottom row to be centered:

I know how do I accomplish this? I think I need to modify subplot somehow, but I'm not sure.
thanks!
0 Comments
Answers (1)
Steven Lord
on 12 Oct 2020
Edited: Steven Lord
on 12 Oct 2020
Those are two rows of subplots. The first has three subplots:
subplot(2, 3, 1, 'Color', 'r')
subplot(2, 3, 2, 'Color', 'g')
subplot(2, 3, 3, 'Color', 'b')
The latter has two subplots, but because of the way you want them arranged I'd actually split that row into six and make those subplots span two of the six subplots in that row.
subplot(2, 6, 8:9, 'Color', 'y') % red + green
subplot(2, 6, 10:11, 'Color', 'c') % green + blue
If you wanted to think of the subplots as the same size / number of "pieces" rather than splitting the two rows into different numbers of pieces, each of the subplots in the top row will span two of the smaller "pieces".
figure
subplot(2, 6, 1:2, 'Color', 'r')
subplot(2, 6, 3:4, 'Color', 'g')
subplot(2, 6, 5:6, 'Color', 'b')
subplot(2, 6, 8:9, 'Color', 'y') % red + green
subplot(2, 6, 10:11, 'Color', 'c') % green + blue
The two approaches don't give exactly the same sized subplots in the first row, but you can decide which looks better for your application.
0 Comments
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!