amkas90
amkas90

Reputation: 139

Axes takes up entire screen in MATLAB GUI

There must be a simple answer to this. I cannot really find a suitable response after a lot of searching.

This is what I want to make using the GUIDE tool.

enter image description here

This is what I get. (Note: the plot is made using the subplot function)

enter image description here

What am I doing wrong? Shouldn't the plot simply fit into the predefined 'axes1' rectangle from the GUIDE interface?

Upvotes: 1

Views: 259

Answers (2)

mannykoum
mannykoum

Reputation: 81

The way I solved this is by putting the axes in a separate panel, thus restraining them to the size of the panel. Hope it helps!

PS: I am using subplot too.

Upvotes: 1

amkas90
amkas90

Reputation: 139

If you use the subplot function within the GUI it will override the axes defined using GUIDE. Instead it is best to plot two separate axes.

%this will plot axes 1    
axes(handles.axes1)
plot(x,y)
title('Title of Axes 1'
ylabel('y Label of Axes 1')
xlabel('x Label of Axes 1')

%this will plot axes 2
axes(handles.axes2)
plot(x,y)
title('Title of Axes 2'
ylabel('y Label of Axes 2')
xlabel('x Label of Axes 2')

Upvotes: 0

Related Questions