Matlab:2行10列的子图 [英] Matlab: Subplot for 2 rows and 10 columns
问题描述
如何在Matlab中以2行10列的方式绘制20张图像?我知道我必须使用
How can I plot 20 images in one plot with 2 rows and 10 columns in matlab? I know I have to use
subplot()
subplot()
功能.但是我对要给出的参数感到困惑.
function. But I am confused regarding the parameters to be given.
我尝试给
子图(2,10,row_index,col_index)
subplot(2,10,row_index,col_index)
但是它似乎不起作用.请帮忙.
but it doesn't seem to work.Please help.
推荐答案
subplot
函数的前两个参数分别给出图中子图的总行数和总列数,而第三个参数给出以下行:当前子图的明智的线性索引.如果您需要2x10的图像矩阵,则将其编号如下:
The first two arguments of the subplot
function give the total number of rows and columns of subplots in the figure, respectively, and the third gives the row-wise linear index of the current subplot. If you want a 2x10 matrix of images, they will be numbered like this:
1 2
3 4
5 6
7 8
9 10
例如,可以使用subplot(2,10,6)
设置第二个倒数,第三个倒数.
So, for instance, the second one over, third one down can be set using subplot(2,10,6)
.
您不仅限于将单个图像/轴放在单个子图上.如果要跨前两列跨越某个轴,则可以使用subplot(2,10,[1 2])
,并且该轴将拉伸以填充两个点.
You are not limited to putting a single image/axis on a single subplot. If you wanted to span an axis across the top two columns, you would use subplot(2,10,[1 2])
and the axis would stretch to fill both spots.
这篇关于Matlab:2行10列的子图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!