How do you vary titles for each row and column for subplots?
10 views (last 30 days)
Show older comments
I have subplots and their titles vary depending on the column and row they are in. How do I vary the title names for each column and row in matlab? For instance, if I choose 2 subjects and 2 extremities, I will have four subplots. I need the first row to be subject 1 and the second to be subject 2. I need column one to be extremity 1 and column two to be extremity 2. The subjects and the extremities change depending on what was chosen in the array before. So if I choose 3 subjects, I would need the last row to be subject 3. Does anyone know the code to do this?
Thanks
0 Comments
Answers (1)
Image Analyst
on 15 Apr 2013
Edited: Image Analyst
on 15 Apr 2013
Try this:
counter = 1;
numberOfSubjects = 2;
numberOfExtremities = 3;
for subject = 1 : numberOfSubjects
for extremity = 1 : numberOfExtremities
caption = sprintf('Subject %d, Extremity %d',...
subject, extremity);
subplot(numberOfSubjects, numberOfExtremities, counter);
title(caption, 'FontSize', 20);
counter = counter + 1;
end
end
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
2 Comments
Image Analyst
on 16 Apr 2013
Sorry for the delay. Do you have this figured out by now, or do you still have questions? If not, what is the size of Plotting_Array?
See Also
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!