subplot sets the current axes to a chosen cell of the current gridded figure

## Syntax

                subplot(m,n,p)
                subplot(mnp)

## Arguments

m, n, p

  positive integers

mnp

  an integer with decimal notation `mnp`

## Description

subplot(m,n,p) or subplot(mnp) virtually grids the graphics window into an m-by-n matrix of sub-windows, and selects the pth sub-window for receiving the forthcoming drawings.

Into the grid, cells are indexed along each row, starting from the top row. Hence, for instance the last cell of the first row is the p = nth one. The cell on the row #i and the column #j has the index `p=(i-1)*n+j`.

When the selected area matches exactly an existing axes, `subplot(…)` just sets it as the current axes, and returns.

Otherwise, `subplot(…)` creates an empty axes covering the selected area, ready to receive forthcoming plotting contents.

## Examples

                clf
                subplot(221)
                plot2d()

                subplot(222)
                plot3d()

                subplot(2,2,3)
                param3d()

                subplot(2,2,4)
                bar3d()

subplot(221) plot2d() subplot(222) plot3d() subplot(2,2,3) param3d() subplot(2,2,4) bar3d()

A more complex layout, but still gridable:

                clf
                subplot(1,2,2)
                Matplot1()
                xtitle("Matplot1() example","","")

                subplot(2,2,1)
                histplot
                delete(findobj("type","Legend"))

                subplot(2,2,3)
                title("Smaller plots:", "fontsize",3)

                subplot(2,4,5)
                polarplot()

                subplot(2,4,6)
                param3d()
                xtitle("","","","")

clf subplot(1,2,2) Matplot1() xtitle("Matplot1() example","","") subplot(2,2,1) histplot delete(findobj("type","Legend")) subplot(2,2,3) title("Smaller plots:", "fontsize",3) subplot(2,4,5) polarplot() subplot(2,4,6) param3d() xtitle("","","","") gcf().axes_size = [670 400];

## See also

- xsetech
- newaxes
- axes_properties
- plotframe