Resize plot to fit text
古いコメントを表示
Is it possible to resize the y-axis automatically, so that my text always fits in the plot.
(as far as I can see, it is not clearly possible by using the "axis" and "ylim" functions)

3 件のコメント
Walter Roberson
2019 年 12 月 9 日
Yes, it is possible. However, it is a nuisance at the best of times, and gets to be a pain if any text anywhere on your plot is using tex or latex interpreter.
It is a lot easier to just examine the current ylim() and make it a bit larger, such as giving an extra 5%. This simplistic solution does not take into account that there might be existing text that is notably off-screen: it makes no attempt to locate the text objects and figure out if they are visible and fontsize and vertical alignment and complications caused by tex or latex interpreters... but for the case you give the example for, making ylim just a bit larger is very likely to be good enough.
Davor Pavlovski
2019 年 12 月 9 日
Walter Roberson
2019 年 12 月 9 日
The only methods I can think of are not clean.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
