Can I remove axes from a tiledlayout, and have it reflow?
66 views (last 30 days)
Suppose I create a flowing tiledlayout
and add a few plots with
The layout automatically rearranges the tiles to fit each new axes. But now suppose I want to remove one of my old axes to make more room for the rest? How can I remove an axes from a the tiledlayout, so that it rearranges and resizes the remaining axes?
Obviously I could save each axes in an array as I create it, and then re-create the tiledlayout from scratch, but maybe there's an easier way.
Rishik Ramena on 21 Mar 2021
You can index the tiles using the nexttile(tilelocation) format. Then use the delete(gca) to delete any previously created tile axes. Have a look at the example below.
x = linspace(0,30);
y1 = sin(x/2);
y2 = sin(x/3);
y3 = sin(x/4);
% Plot into first tile three times