MATLAB: How to color individual lines in a plot

colormapdefault color orderplotting

Hello all,
I'm a novice user and I'm attempting to use something like "colormap jet" on a plot so that each line within the plot is a different color. The x-axis is temperature and the y-axis is depth. Each line is at a temperature, so I'd like the colors to make the graph easier to read (e.g. colder to hotter).
I haven't found a solution on here that works so far. I think it might have to do with how the data are plotted.
Here's the code:
dates = datevec(datetime); %set matlab dates to year,month,day,hour,min,sec
dates = dates'; %invert
temp_crop = calTemp(387:417,:); %only interested in temps along this length of cable
ind_midnight = find(dates(4,:)==0); %finding all temp measures along cable where hour is 0 (midnight)
ind_noon = find(dates(4,:)==12); %same as above, but with noon

midnighttemps = temp_crop(:,ind_midnight); %have all temps along cropped section of cable for each day at midnight
noontemps = temp_crop(:,ind_noon); %same as above, but with noon
close all
figure;
subplot(1,2,1);
plot(midnighttemps);
view([90 -90]);
title('midnight');
subplot(1,2,2);
plot(noontemps);
view([90 -90]);
title('noon');
You can see how the plot is actually plotting individual matrices with a single column. I think this might be why I can't do a simple colormap or colorbar. I've also tried a few for loops such as this:
x = [0:0.1:10];
linecolors = jet(5);
for i=1:5
plot(x,x.^(i/3),'color',linecolors(i,:));
hold on;
end
I found this on StackOverflow, and the graph it produces is what I'd like, individually colored lines on a gradient, but I can't seem to get it to work. Again, I think this is because I'm plotting an entire matrix. Any suggestions?
Thank you for any assistance.

Best Answer

You can change the default color order to do exactly what you want. In fact I already have a demo that does it. See attached m-file.
0000 Screenshot.png