Search code examples
matlabgpsmaps

How to plot multiple figures in one window on MATLAB


I have three figures of gps data I have plotted on a map using the geobubble function.I am trying to represent the number of plastics at different survey locations.

I would like to present these in one figure but i can only get them to open in separate figure windows.

If anyone could help that would be great. Thank you!


Solution

  • The subplot function does what you want.

    For example, if you want a figure with two axes arranged in a 2x1 matrix:

    figure
    ax(1) = subplot(2,1,1);
    [Plot things...]
    ax(2) = subplot(2,1,2);
    [Plot more things]
    

    Or if you want them all graphed on the same axes, just use the hold function.

    figure
    hold on
    plot(x1,y1)
    plot(x2,y2)
    etc...