Plots of different color for different arrays.

1 次查看(过去 30 天)
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 个评论
Phenomenal One
Phenomenal One 2019-5-21
Thanks guys, it is solved I just replaced 'MarkerFaceColor' with 'color' and it works nicely now! cheers!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by