How can I plot points of different color shade each iteration?

조회 수: 8 (최근 30일)
Riccardo Andreoni
Riccardo Andreoni 2019년 11월 7일
댓글: KALYAN ACHARJYA 2019년 11월 7일
Hello,
I have an iterative algorithm and every iteration it gives me some points.
I want to plot the points at each iteration on the same graph such that the final result is like this:
untitled.png
The problem is that I want that for each iteration the color of the points changes a little (like having a gradient of colors). This way I have a scale of color and it is possible to undersand which points belong to which iteration. I also want to insert in the graph a legend of the color shade.
I don't know if I explained myself well.
Thank you for the help

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 7일
편집: KALYAN ACHARJYA 2019년 11월 7일
One way:
col=[define colors here];
% define colors in strings, like 'b','r'...see color in Matlab.
% Define colors equal to loop iterations
for loop ieration
scatter(variable1,variable2,col(i))
end
  댓글 수: 2
Riccardo Andreoni
Riccardo Andreoni 2019년 11월 7일
Thank you for the kind reply. How can I print the legend in the plot? Thank you
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 7일
Please check here, any issue let me know?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by