Plot a row with different color

조회 수: 8 (최근 30일)
Asim Ismail
Asim Ismail 2017년 5월 12일
편집: Asim Ismail 2017년 5월 12일
I have a simple 10x2 matrix with random values, scattered in a plot
a=rand(10, 2)*10;
scatter(a(:, 1),a(:, 2))
Suppose somehow I got values of a row, without knowing which row exactly it is, is there a way to draw the plot again, but this time the certain row will be painted in a different color than the others?

채택된 답변

KL
KL 2017년 5월 12일
편집: KL 2017년 5월 12일
a=rand(10, 2)*10;
scatter(a(:, 1),a(:, 2))
hold on
x = randi(length(a)) %your random row
scatter(a(x,1),a(x,2),'m')
  댓글 수: 1
Asim Ismail
Asim Ismail 2017년 5월 12일
편집: Asim Ismail 2017년 5월 12일
Its working, thanks a lot

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by