필터 지우기
필터 지우기

Plots of different color for different arrays.

조회 수: 1 (최근 30일)
Phenomenal One
Phenomenal One 2019년 5월 21일
댓글: Phenomenal One 2019년 5월 21일
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