Post by m***@gmail.comSearching on this forum with 'subplot gui' shows that loads of other users
have come across the same problem. Subplot splits the current figure (ie
the whole GUI canvas) not the current axes (ie axes1 uiobject).
That is correct. Axes cannot be children of axes; they are children of
figures or uipanels. The axes created by SUBPLOT are no different in this
respect.
Post by m***@gmail.comThe common suggestion is to create exactly number of axes you need in your
GUI then send each plot command to a specific axes. This works fine when
you know in advance how many plots you need. If the number of plots is
defined by user input or the number of data series this is no good.
If you know an upper limit, you can mentally partition off your figure. For
example, if you know you want to support up to 6 axes and you want those
axes to cover the top half of your figure, tell SUBPLOT to create a "grid" 4
axes high and 3 wide and only use locations 1 through 6.
c = [1 0 0; 0 1 0;
0 0 1; 1 0 1;
1 1 0; 0 1 1];
for k = 1:6
ax = subplot(4, 3, k);
set(ax, 'Color', c(k, :))
end
This should create six axes: red, green, and blue in the first row and
magenta, yellow, and cyan in the second.
If you don't have an upper limit, you risk your user asking for a million
plots and your machine screeching to a half (or MATLAB throwing an error or
crashing when your machine runs out of memory to use to create the
graphics.)
Post by m***@gmail.comSubplot would be ideal for this but I can't see a solution. I can use
subplot in a separate figure (outside the GUI) but I really need it within
the GUI to allow uicontrols to control the data in the plots.
--
Steve Lord
***@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com