Plotting lines in subsequent color order, line marker and line style.
Show older comments
Hi, I am selecting different R1.csv, R2.csv, R3.csv and R# in increasing number of files and the way I have them
set up now is that the first one that meets i==I_file prints it in red and the rest of selected
R#.csv Files are printed in black. However I want to create a loop that each file is printed in
a different line color. I've tried doing here something below but it does not work.
Can you suggest? Can the 'colororder' function work out for something like this?
do I need to define color everytime? Can the lines be on a loop as only 4 linestyles exist?
fileList = 1:length(fileNums);
%symbolList = ['o', 'x', 's', 'd','.', '^', 'v', '>', '<', '*','p', 'h','+'];
symbolList = [ 'o', '+', '*', '.', 'x', '_', '|', 's', 'd', '^', 'v', '>', '<', 'p', 'h', 'none'];
%colorList= [ [0, 0, 1], [0, 0.5, 0], [0, 0.4470, 0.7410], [0, 0.75, 0.75], [0.75, 0, 0.75], [0.75, 0.75, 0], [0.25, 0.25, 0.25] ];
colorList = ['#F00','#F80','#FF0','#0B0','#00F','#50F','#A0F'];
lineList = ['-', '--', ':', '-.'];
figure(3);
ax1 = gca;
ax1.Units = 'normalized';
for j=1:length(fileList)
i = fileList(j);
if i==I_file %NOTE: TO GET RID OF LINES, DELETE THE DASH in 'r%s-' etc.
%symbol = sprintf('r%s-', symbolList(mod(j-1,length(symbolList))+1));
symbol = sprintf('r%s%s', symbolList(mod(j-1,length(symbolList))+1), lineList(mod(j-1,length(lineList))+1) );
p=plot(I_u_std(:,i), z/z_of_V_max, symbol, 'LineWidth', 1);
p.DisplayName = sprintf('x/b=%3.3g', x_b(fileNums(i)));
elseif ~hideOtherXoverBs
%symbol = sprintf('k%s-', symbolList(mod(j-1,length(symbolList))+1));
symbol = sprintf('%s%s%s',colorList(mod(j-1,length(colorList))+1), symbolList(mod(j-1,length(symbolList))+1), lineList(mod(j-1,length(lineList))+1) );
p=plot(I_u_std(:,i), z/z_of_V_max, symbol, 'LineWidth', 0.1);
p.DisplayName = sprintf('x/b=%3.3g', x_b(fileNums(i)));
end %if
hold on;
end %for i
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!