フィルターのクリア

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 ビュー (過去 30 日間)
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.

採用された回答

dpb
dpb 2022 年 10 月 17 日
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 件のコメント
dpb
dpb 2022 年 10 月 17 日
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.
Mark Stone
Mark Stone 2022 年 10 月 17 日
Thanks. 'horizontalalignment','right' is exactly what I need.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by