Adding a subplot axes to an existing figure.

16 次查看(过去 30 天)
Greetings -
Is there away to expand the size of a subplot grid once it has been created. Suppose I the following subplot:
h = figure();
h1 = subplot(2,1,1); plot(rand(10,1));
h2 = subplot(2,1,2); plot(rand(10,1));
I would like to be able to add a third subplot to the array without recreating the figure.
I have looked into two ways of doing it so far. Once with modifying the appdata for the figure using getappdata(h, with "SubplotListeners" and "SubplotGrid" and havent had much sucess. The other thing I was considering is simply creating a new figure off the screen, copying the axes handles over to it and moving it into the screen while deleting the old one.
Has anyone has sucess with something similar to this?
Best Regards,
Brandon

回答(1 个)

Walter Roberson
Walter Roberson 2012-7-26
subplot() works by position. Set new Position (or possibly OuterPosition) for the existing subplots and then you can subplot() the new one into place. If I recall correctly, you can read the source,
type subplot

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by