Borrar filtros
Borrar filtros

How to use text command with text left of xline and \rightarrow pointing to xline? Easy to place text right of xline with \leftarrow pointing from beginning of text to xline.

24 visualizaciones (últimos 30 días)
plot(1:5,1:5);hold on;xline(2);
% Next line works as intended if want text right of xline with arrow pointing left to xline
text(2,1.5,'\leftarrow sample text right of xline, arrow points at xline')
% How to do similar, but text left of xline and arrow pointing right from text to xline?
% Next line doesn't do what is desired
text(2,2.5,'\rightarrow arrow pointed from xline to the right where this text is')
% Next line would work if x coordinate of text was corect amount less than xline value
text(2,3.5,'text begins just right of xline, arrow at end of text points right \rightarrow')
Also open to commands) other than text which would accomplish this.

Respuesta aceptada

dpb
dpb el 17 de Oct. de 2022
You could adjust the starting point to move the prepended right arrow where want it, but don't fight it; just put the two pieces on separately. I left an extra space in front of the text so wouldn't be right on the line itself; suit your purposes in that regards.
plot(1:5,1:5);hold on;xline(2);
text(2,3.5,'\rightarrow','horizontalalignment','right')
text(2,3.5,' text begins just right of xline')
  3 comentarios
dpb
dpb el 17 de Oct. de 2022
Well, why didn't you say so...the answer is the same -- use the 'HorizonatalAlignment','right' property to put the right end of the text at the marker location...
plot(1:5,1:5);hold on;xline(4);
text(4,3.5,' text ends just before xline \rightarrow','horizontalalignment','right')
NOTA BENE: you'll have to find the intersection of the two lines to point the arrow precisely at that location.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by