3 on top, 2 on bottom subplot
显示 更早的评论
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!
回答(1 个)
Steven Lord
2020-10-12
编辑:Steven Lord
2020-10-12
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Subplots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!