필터 지우기
필터 지우기

Displaying figures with differents colors for matlab

조회 수: 1 (최근 30일)
Malstheet
Malstheet 2014년 5월 29일
댓글: Adam 2014년 5월 30일
i have matlab code that generate 3D points , so i want to plot each 3D points with different color
my last code for generat all points are
figure(i),plot3(mx,my,mz,'b*');
and this one plot all peaks but with same color witch are blue and the image below show u how my code work

답변 (1개)

Adam
Adam 2014년 5월 29일
Hi Malstheet, try to convert the vertors mx , my and mz into the diagonal matrices. Also, erase the letter b defining the blue color. The color of your points should be different, however, it will repeat in a cycle...
Try this:
plot3(diag(mx),diag(my),diag(mz),'*');
Hope it helps you. Adam
  댓글 수: 4
Malstheet
Malstheet 2014년 5월 29일
CData ??? must be the colors
Adam
Adam 2014년 5월 30일
It should have different colors. Could you specify your definition of mx , my and mz vectors?
Try this:
mx = linspace(1,100,100);
my = linspace(1,100,100);
mz = linspace(1,100,100);
scatter3(mx,my,mz,'*','CData',sqrt(mx.^2+my.^2+mz.^2));
CData could be defined in couple ways. For (1xN) vectors (or transpose) the CData vector would have same size (1xN). Each value defines the color of corresponding point. E.g. Point mx(1),my(1),mz(1) will have color CData(1) - according to the value related to the range.

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

카테고리

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