changing the location of num2str

2 visualizaciones (últimos 30 días)
KalMandy
KalMandy el 11 de En. de 2017
Respondida: Walter Roberson el 11 de En. de 2017
Hi, I am using the following to illustrate the index of the (x,y) location inside a polygon. text(x(i),y(i),num2str(i) With the above code I get the numbers exactly on the (x,y) point. Does someone know how to change that location?

Respuesta aceptada

Stephen23
Stephen23 el 11 de En. de 2017
Editada: Stephen23 el 11 de En. de 2017
Add an offset to the x (and/or y) location:
d = 0.01;
text(x(i)+d,y(i),num2str(i))
Remember that x and y are data units: you will need to pick a value of d that makes sense for your data.

Más respuestas (1)

Walter Roberson
Walter Roberson el 11 de En. de 2017
text() offers horizontal and vertical alignment options so that you can say whether the text is to begin at that coordinates or end there or be centered there.

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by