How to customize the markers of the scatter figure, as shown below

조회 수: 2 (최근 30일)
Kelin Chen
Kelin Chen 2024년 11월 14일
댓글: Kelin Chen 2024년 11월 14일
How to use matlab to reproduce the following scatter figure?
As shown below:

채택된 답변

Matt J
Matt J 2024년 11월 14일
편집: Matt J 2024년 11월 14일
Here's one way. Not sure you'll like the gymnastics that it requires:
[x,y]=deal(rand(1,40), rand(1,40)); %scattered input data
scatterCustom(x,y)
function scatterCustom(x,y)
%%Create marker prototypes
t=linspace(-pi/2,pi/2,1000)';
t(end+1)=t(1);
p=polyshape([cos(t),sin(t)]/35);
q=rotate(p,180);
f=@(zz,xx,yy) arrayfun(@(u,v) translate(zz,u,v),xx,yy); %translator
%%Plot
plot(f(p,x,y),FaceColor='b');hold on;axis equal
plot(f(q,x,y),FaceColor='none');hold off
end

추가 답변 (1개)

Walter Roberson
Walter Roberson 2024년 11월 14일
편집: Walter Roberson 2024년 11월 14일
Unfortunately, markers are only customizable between a limited number of pre-set shapes.
Or I suppose you could use fill()

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by