Add Components to a Programmatic UI
f = figure;
ax = axes('Parent',f,'Position',[.15 .15 .7 .7]);
The first two arguments passed to the axes function, 'Parent',f specify the parent
container. In this case, the parent is a figure, but you can also specify the parent to be
any container, such as a panel or button group.
'Position',[.15 .15 .7 .7] specifies the location and size of the axes as a fraction
of the parent figure. In this case, the axes is 70 percent of the width of the figure and
70 percent of its height. The left edge of the axes is located at 15 percent of the figure’s
width from the left. The bottom of the axes is located 15 percent of the figure’s height
from the bottom. If the figure is resized, the axes retains its original proportions.
Prevent Customized Axes Properties from Being Reset
Data graphing functions, such as plot, image, and scatter, reset axes properties
before they draw into an axes. This can be a problem when you want to maintain
consistency of axes limits, ticks, colors, and font characteristics in a UI.