how can I seperate between points id and scatter markers in figure?
조회 수: 2 (최근 30일)
이전 댓글 표시
example;
x=[1000;1100;1200];
y=[2000;2100;2200];
points_id={'p100';'p200';'p300'};
figure(1),scatter(x, y, 'b^');grid on;
text(x, y, points_id);
%There is no space between points id and scatter markers in figure so I need to seperate them a bit more for more conveniently looking.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Sean de Wolski
2014년 4월 14일
So something like this? If not, please clarify.
x=[1000;1100;1200];
y=[2000;2100;2200];
points_id={'p100';'p200';'p300'};
figure(1),scatter(x, y, 'b^');grid on;
text(x, y, points_id);
hold on;
plot(x,y);
% Calculate distances
dists = hypot(x(1:end-1)-x(2:end),y(1:end-1)-y(2:end));
% Calculate midpoints for text
midx = conv(x,[0.5 0.5],'valid');
midy = conv(y,[0.5 0.5],'valid');
text(midx,midy,num2str(dists))
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!