Borrar filtros
Borrar filtros

Plots of different color for different arrays.

1 visualización (últimos 30 días)
Phenomenal One
Phenomenal One el 21 de Mayo de 2019
Comentada: Phenomenal One el 21 de Mayo de 2019
I am trying to plot different arrays based on the color.
W = [];
colarray = [1,0,0;0,1,0;0,0,1;1,1,0;1,0,1;0,1,1;0.3,0.8,0.6;0.4,0.5,0.4];
for i =1: num_its
W = A{i};
% size(W)
plot(W(:,1),W(:,2),'.','MarkerFaceColor',colarray(i,:));
end
Above is just a part of the code. Here A{i} is an array having 100 rows and 2 columns. Each A{i} has different elements in it. num_its = 6 here.
I thought it would plot the elements of A{1} in red color and then A{2} in green color A{3} in blue color as specified by colarray but it did not it is displaying some other colors which are not in the 'colarray'? I am thinking how can I rectify it so that it plots different colors as specified by 'colarray' for each iteration/ different arrays.
  1 comentario
Phenomenal One
Phenomenal One el 21 de Mayo de 2019
Thanks guys, it is solved I just replaced 'MarkerFaceColor' with 'color' and it works nicely now! cheers!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by