- Take the length of the string you wish to plot ('m') and separate your curve into m+1 points that are equidistant from each other.
- Find the slope between the two points and use 'atan' to calculate the degrees or radians of the slope.
- Use the 'rotation' property of 'text' to set the rotation of the letter to the desired rotation of the curve. Plot each letter to each equidistant point on the desired curve.
How can I draw curved text on a curved line so that the text follows the line?
15 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2020 年 10 月 6 日
回答済み: Zaid hamamah
2022 年 4 月 7 日
I have a curved line that I want to plot text on. I wanted the text to follow the curve on the line. How can I do this?
採用された回答
MathWorks Support Team
2020 年 10 月 6 日
Currently, there is no built-in option to have text follow the curvature of a line it is plotted on.
One current workaround to this is to plot each letter on the line while rotating the letter to match the curve of the line at the point. To do this:
For more information regarding 'text', please refer to the link below:
0 件のコメント
その他の回答 (1 件)
Zaid hamamah
2022 年 4 月 7 日
Hi, it might be too late to answer the question but just for the future readers:
try this code:
It has an option where you can add 'slope' at the end of the command syntax to get the text in line with the local slope. You can also choose where to put the text.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!