Auto resize of manually added axes
14 views (last 30 days)
I need to manually add axes to a figure, but I want the axes I add to automatically resize when I maximize/scale the figure window. When I create the axes using 'subplot.m,' the axes scale when I maximize the window, which is what I want. When mannually adding axes (see code below) the resulting axes don't grow with the window size. How might I do this?
fig_h = figure;
ax_h = uiaxes(fig_h);
I've looked through both the axes and figure object properties for a something related to auto resizing, but haven't found anything. Any bright ideas would be appreciated.
Prahlad Gowtham Katte on 16 Feb 2022
As per my understanding of the query, you are trying to find out why the axes you added manually is not resizing when figure is resized. The answer as mentioned in the comments Is that your axes’ units should be set to “normalized” but since you have created an axes using “uiaxes()” function the default Units property would be set to “Pixels”.
To change it to normalized the following line would help
But if you create an axes using axes function, the default Units property is set to be normalized and it resizes without any additional code.
The following links would be helpful to learn more about properties of uiaxes and axes
Hope it resolves the query.