Get a plot to automatically load different colors using a matrix
Ältere Kommentare anzeigen
I am trying to plot 16 different sets of data onto 1 plot, and my adviser suggested concatenating the data I am using (amplitude data) and then when plotting it should load all 16 in different colors automatically. I was able to concatenate the data, but for some reason I can't get it to plot correctly. Here is a snippet of my data below:
load(FILENAME);
respidx = find(n1p2amp > THR_CRIT);
allamp = cat(2, n1p2amp,allamp);
plot (masker*ELEC_SPACE,allamp)%plots amplitude data
xlabel('Masker Electrode (re: electrode spacing)')
ylabel ('Amplitude (mV)');
text(masker(respidx(maxidx))*ELEC_SPACE,n1p2amp(respidx(maxidx)),[num2str(maskch)],...
'VerticalAlignment','middle',...
'HorizontalAlignment','right',...
'FontSize',10)
hold on;
set(gca,'XLim',[0*ELEC_SPACE 16*ELEC_SPACE],'YLim',[-0.1 0.6]);
set(gca, 'XTick',0:4*ELEC_SPACE:16*ELEC_SPACE);
This is all contained within the loop "i" which is essentially numbered 1:16. I have a 16x16 matrix for each subject, so the x-axis has 16 points with each point containing 16 data points, if that makes sense. I just don't want to have to manually tell this to do 16 different colors. Thanks!
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 2 Okt. 2014
0 Stimmen
The easiest way is to specify the color when you plot. If you don't you get the default colors. Maybe you'd be interested in my ColorOrder demo where you can alter the default colors.

3 Kommentare
Lindsay
am 2 Okt. 2014
Lindsay
am 2 Okt. 2014
Image Analyst
am 2 Okt. 2014
You're welcome. Maybe you could "Vote" for the answer even if it didn't earn your "Acceptance", if it at least you learned something from it.
Kategorien
Mehr zu Orange finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!