Make subplot use the full figure on buttondown click.
Ältere Kommentare anzeigen
Hello,
I have the following figure with 2 subplots for the example (I have multiple tabs with various numbers of subplots so it has to stay flexible!).
I want to be able to click on either subplot to make it take the full space (as if it was created as a single axis/plot), and if I click again on it that it reverts back to the original subplots.
So far I have only found how to make the axes invisible and thought I could somehow manipulate the figure, but I am stuck now. It is probably not the right way to go though...
hFig = figure();
ax(1) = subplot(2, 1, 1);
hold all
p(1) = plot(ax(1), [0,1], [1, 1], 'b');
ax(2) = subplot(2, 1, 2);
hold all
p(2) = plot(ax(2), [0,1], [1, 2], 'r');
set(ax(1), 'ButtonDownFcn',{@subplotZoom, ax, p})
set(ax(2), 'ButtonDownFcn',{@subplotZoom, ax, p})
function subplotZoom(src,eventdata, ax, p)
set(ax, 'Visible', 'off')
set(p, 'Visible', 'off')
end
Thanks
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Stateflow Programmatic Interface finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!