Every 1,5,9,13..... marker point should be of same color. Similarly 2,6,10...... and 3,7,11...... and 4,9,12.... should be of same color

2 visualizaciones (últimos 30 días)
As shown in the plot below. I need the marker color of [1,5,9,13........] of same color. Similarly [2,6,10,.....] for e.g., green; [3,7,11......] for e.g blue; [4,9,12...] for e.g. magenta.
Thanks ,
Aristo

Respuesta aceptada

DGM
DGM el 3 de Abr. de 2021
Editada: DGM el 3 de Abr. de 2021
Try something like this:
len = 1000; % dataset length
x = linspace(0,10,len);
y = exp(x/10).*sin(4*x);
colors=[1 0 0; ...
0 1 0; ...
0 0 1; ...
1 1 0];
clf;
plot(x,y); hold on;
ncolors=size(colors,1);
for p=1:ncolors
plot(x,y,'o','MarkerSize',8,...
'MarkerEdgeColor','red',...
'MarkerFaceColor',colors(p,:),...
'MarkerIndices',p:ncolors:len)
end
This requires a relatively recent version. I'm not sure of the exact version, but the 'markerindices' property isn't a thing in R2015b at least.

Más respuestas (1)

Jan
Jan el 3 de Abr. de 2021
x = 1:100;
y = rand(1, 100);
colorPool = [1,0,0; 0,1,0; 0,0,1; 1,0,1];
figure;
axes('NextPlot', 'add'); % Equivalently to: hold('on')
plot(x, y, 'b-');
for k = 1:4
ind = k:4:100;
plot(x(ind), y(ind), 'o', 'MarkerEdgeColor', colorPool(k, :));
end

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by