# Subplots within a GUI figure

18 views (last 30 days)

Show older comments

##### 7 Comments

### Answers (2)

Image Analyst
on 11 Feb 2017

Pappu, is this what you mean:

% Plot top plot.

subplot(2, 2, 1);

plot(1:10, 'bo-');

title('subplot(2, 2, 1)');

% Plot middle plot.

subplot(2, 2, 2);

plot(sind(1:80), 'rd-');

title('subplot(2, 2, 2)');

% Plot 4 more plots in the bottom left spot

subplot(4, 4, 9);

scatter(rand(1,40), rand(1,40));

title('subplot(4, 4, 9)');

subplot(4, 4, 10);

plot(exp(1:10)/30000, 'ko-');

title('subplot(4, 4, 10)');

subplot(4, 4, 13);

plot(exp(rand(1,10)), 'co-');

title('subplot(4, 4, 13)');

subplot(4, 4, 14);

plot(exp(1:-.1:0), 'go-');

title('subplot(4, 4, 14)');

##### 4 Comments

Image Analyst
on 11 Feb 2017

You need to put two panels on your GUI. One will contain the single large axes, and the other will contain the 4 small axes. Then you just set the visible property to 'on' or 'off' to show whichever you want

% Show 4 axes

handles.panelFour.Visible = 'on'; % Show 4 axes.

handles.panelOne.Visible = 'off'; % Hide large axes.

% Show single large axes

handles.panelFour.Visible = 'off'; % Hide 4 axes.

handles.panelOne.Visible = 'on'; % Show large axes.

##### 4 Comments

Image Analyst
on 13 Feb 2017

I did not reference any variable or control called "mypicture". You use GUIDE and put two panels on it. I called them panelFour and panelOne but you can call them whatever you want. Reference them with the names that you actually used.

In one panel, place one axes. In the other panel, place 4 axes.

Then just set the visibility property of the two panels to show one and hide the other.

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!