Resize plot to fit text
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 9 Dez. 2019
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
am 9 Dez. 2019
Walter Roberson
am 9 Dez. 2019
The only methods I can think of are not clean.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Graphics Object Properties finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
