Hey folks –
This one's a problem with a loop I wrote to plot a handful of figures, each with two subplots, and I can't seem to figure out how to keep the title above the subplots from disappearing. Here's my code for the loop:
for i = 1:plotPCnum I = num2str(i); h = figure; titlestr = char(['Scores and loadings for PC ',I]); title(titlestr); subplot(1,2,1); ... box('on'); hold('all'); plot(loads_wt(:,i)); axis square; axis tight; title(['Loadings PC ',num2str(I)]);... set(axes, 'XTick', [], 'YTick', []); subplot(1,2,2); imagesc(reshape(scores_wt(:,i), [nrows ncols]));... axis image; title(['Scores PC ',num2str(I)]); colormap('jet'); colorbar set(gca, 'XTick', [], 'YTick', []); saveas(h,titlestr,'fig'); logline = char([titlestr,' has been created.']); fprintf(fidOUT,'%s\n',logline); end
What happens is that at the top right after I open the figure h and give it a title, as soon as the first subplot is opened that title disappears, and all I get is a series of plots each with 2 subplots with the subplot titles only. How can I code the figure title above the subplot titles so it doesn't disappear?
Also, the subplots are different sizes and I would like them to be the same size. How can I force this?
Thanks,
Jason
Best Answer