Plot‎ > ‎

Sample colors

Plot samples in different colors


Multiple colors: set color order
define in the beginning the color-order for all plots
set(0,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1])

or, for an individual plot
h = plot(...)
set(h,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1])


plot selected samples in different color
X = randn(2,100);   % data set X
idx = 1:10; % select first 10 samples to highlight in red
h1 = plot(X(1,:),X(2,:),'.','Color',[0.7,0.7,0.7]); hold on   % plot all samples in grey
h2 = plot(X(1,idx),X(2,idx),'.','Color','red'); hold off    % plot selected samples (idx) in red