To create 10 SubPlots generated during for loop with different colours
Show older comments
I have written following code to make 10 line graphs in same plot.
How can I modify this to make individual 10 subplots within same plot screen without overlapping each other ?
What is the trick behind diving the screen into equal parts (eg: 10 here) ?
%%%%%%% CODE STARTS HERE %%%%%%%
pre_list = dir('*.mat');
file_list = {pre_list.name}';
C = {'c'; 'm'; 'y'; 'k'; 'r'; 'g'; 'b'; [.5 .6 .7];[.8 .2 .6];[.1 .2 .3]};
% C = 10 loops for ten plots with different colours %
for i = 1:size(file_list,1)
load(file_list{i,1})
variable_wise = cell(zeros); a = 1;
for j = 1:size(integrated_data,1)
if strcmp (integrated_data{j,3},'Ln Kf-m - Ln Kf-w')
variable_wise(a,1) = integrated_data(j,2);
variable_wise(a,2) = integrated_data(j,5);
a = a+1;
end
end
a = cell2mat(variable_wise(:,2));
plot(a,'color',C{i,1},'LineWidth',2);
hold on
end
Answers (0)
Categories
Find more on Loops and Conditional Statements 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!