Multiline text above the graph

Hello. How can I add multiline text above the graph so that it appears each time the script is enabled?

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 5 月 25 日

0 投票

  • you could use annotation('textbox') https://www.mathworks.com/help/matlab/ref/annotation.html . Note that the coordinates are figure coordinates, not data coordinates
  • you could use a uicontrol() style 'text'
  • you could text(), making sure that the text object property 'Clipping' is not 'on' (it is 'off' by default which is what you would want)
  • you could create a second axes with 'visible', 'off', and text() inside it. If you do this, be careful if you are using subplot(), as subplot() will automatically delete existing axes that are found to be overlapping.

1 件のコメント

jonas
jonas 2018 年 5 月 25 日
Just adding that you can break a string in multiple lines using newline, e.g.
str=['1st line' newline '2nd line'];

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

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

質問済み:

2018 年 5 月 25 日

コメント済み:

2018 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by