Filter löschen
Filter löschen

Plots of different color for different arrays.

1 Ansicht (letzte 30 Tage)
Phenomenal One
Phenomenal One am 21 Mai 2019
Kommentiert: Phenomenal One am 21 Mai 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 Kommentar
Phenomenal One
Phenomenal One am 21 Mai 2019
Thanks guys, it is solved I just replaced 'MarkerFaceColor' with 'color' and it works nicely now! cheers!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by