필터 지우기
필터 지우기

Randomize a marker color for a graph

조회 수: 1 (최근 30일)
Amanda
Amanda 2022년 11월 7일
답변: David Hill 2022년 11월 7일
im trying to randomize a color of a marker but it keeps giving me an error and even if i write out the full color it still doesnt work. i dont know how to fix this.
  댓글 수: 1
Rik
Rik 2022년 11월 7일
You don't actually index your array of letters. How do you expect Matlab to guess what you intended to do?

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

답변 (1개)

David Hill
David Hill 2022년 11월 7일
m='o+*.x';
c='rgbcmyk';
x=randi(20,1,8);
y=randi(20,1,8);
figure;hold on;
for n=1:length(x)
scatter(x(n),y(n),'LineWidth',rand*8,'MarkerEdgeColor',c(randi(7)),'MarkerFaceColor',...
c(randi(7)),'Marker',m(randi(5)));
end

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by