how can I seperate between points id and scatter markers in figure?

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 15 de Abr. de 2014
text(x + 10, y, points_id); %adjust the "10" until it looks good

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 14 de Abr. de 2014
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))
  1 comentario
sermet
sermet el 15 de Abr. de 2014
I think you misunderstood me, I just want to seperate points id and scatter markers a bit more than default view. There is no space between them that's why I need more space. Sorry for late.

Iniciar sesión para comentar.

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by