Azzera filtri
Azzera filtri

Plots of different color for different arrays.

1 visualizzazione (ultimi 30 giorni)
Phenomenal One
Phenomenal One il 21 Mag 2019
Commentato: Phenomenal One il 21 Mag 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 Commento
Phenomenal One
Phenomenal One il 21 Mag 2019
Thanks guys, it is solved I just replaced 'MarkerFaceColor' with 'color' and it works nicely now! cheers!

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by