How to add labels to lines on a plot in MATLAB?

25 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2025 年 3 月 31 日
回答済み: MathWorks Support Team 2025 年 4 月 3 日

When there are a lot of lines on a plot, it can be difficult to use a legend to distinguish individual lines. How can I label individual lines on a plot in MATLAB?

採用された回答

MathWorks Support Team
MathWorks Support Team 2025 年 3 月 31 日
Adding a text label directly to a "Line" object is not available as of MATLAB R2024b. However, the "annotation" function or "text" function can be used to label individual lines on a plot.
  • The "annotation" function can be used to create a text arrow pointing to a line on a plot. Refer to the MATLAB documentation for more information and examples.
  • The "text" function can be used to add a text description to a point on a plot. Refer to the MATLAB documentation for more information and examples.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by