I tried to allocate a marker to each plot in for loop but I could'nt. would you please help me with that?
I was able to give each plot a disired color but for marker the error shows up.
Many thanks

 채택된 답변

Image Analyst
Image Analyst 2020년 8월 23일

0 개 추천

Try this:
markerShapes = {'.', 's', 'd', '^'}; % However many you need
for k = 1 : numPlots % numPlots must be less than the number of marker shapes.
thisColor = rand(3, 1); % Random color or whatever...
plot(x, y, markerShapes{k}, 'Color', thisColor);
hold on;
end

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 8월 23일

0 개 추천

N = 15;
x = 1 : 20;
y = rand(20, N);
cmap = parula(N);
for K = 1 : N
plot(x, y(:,K), 'color', cmap(K,:), 'DisplayName', string(K));
hold on
end
hold off
legend show

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

질문:

H-M
2020년 8월 23일

답변:

2020년 8월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by