Adding a color scale to loop script
47 views (last 30 days)
Hey. So I have a loop script plotting lines ontop of each other on the same figure. Its messy but it works.
%depth,distance,salinity,temp are in column 28,2,14,11 of datafile respectively;
if A(depthi,28)>z-0.5 & A(depthi,28)<z+0.5;
%delete zero rows in new matrix 'B'
% average repeated measurements for same distances
I would like it, to rather than plot each line with a random colour, to plot each new line according to a colour scale so I can put a color bar on it. Or at least represent that each new line is increasing depth of 1m. Thanks for any help.
Marius on 12 Oct 2015
Hi Aaron, What I do when I plot many plots in a for-loop (N plots) is first create a "colour matrix" (col) based on a colormap (e.g. 'jet'):
col = jet(N);
for i = 1:N
plot( myXYvals(:,N), 'Color', col(N,:) )
Hope this helps, at least giving you an idea... Marius