

It would also be good if LaTeX could apply principles similar to when it arranges text to look its best to arrange pictures as well. What we need is a way of defining figures. To start with, we want a way of adding captions, and to be able to cross-reference. However, just having a picture stuck in between paragraphs does not look professional. The previous chapter introduced importing graphics.

Finally our last plot occupies the second row, third column using subplot(2,3,6). This occupies the second row, and first and second columns. The second plot occupies slots p=4,p=5 using subplot(2,3,4:5). In other words: figure Īs you can see, we have occupied the first row using subplot(2,3,1:3) with the first plot. You can then issue more plots in slots 4, 5 and 6. As an example, if you did: subplot(2,3,1:3), this will take one plot and occupy the entire first row of your figure. If you specify p to be a vector, what this will do is that one plot you make will occupy multiple spaces / slots within the same figure window. If p is a single number, then either subplot(m,n,p) or subplot(mnp) will work.

However, should you do it this way, you must call subplot this way: subplot(m,n,p). You can also specify a vector of points for p.
SUBPLOT MEANING IN ENGLISH CODE
The figure that the code above describes looks like the following: You must make sure that you know how many figures you want within the overall window before you start plotting. Notice that the last parameter of subplot increases linearly, while the first two parameters stay the same. What the above code does is that we generate random sets of points that are 100 x 1 each for pairs of x and y and we plot them in multiple locations within the overall window. Let's create a window that has two rows and three columns worth of figures within the same window. Repeat Step #3 for each plot we have until we run out of subplot slots.Write the necessary code to create your plot like you would for just a plot occupying a single window.Call subplot and choose the right location(s) of where you want the plot to appear.

