Resize plot to fit text
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 9 Déc 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
le 9 Déc 2019
Walter Roberson
le 9 Déc 2019
The only methods I can think of are not clean.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
