Get a plot to automatically load different colors using a matrix
显示 更早的评论
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!
采纳的回答
更多回答(1 个)
Image Analyst
2014-10-2
0 个投票
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 个评论
Lindsay
2014-10-2
Lindsay
2014-10-2
Image Analyst
2014-10-2
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!