Avoid plot title superimposing axis

19 vues (au cours des 30 derniers jours)
Turing Machine
Turing Machine le 19 Nov 2021
Commenté : Turing Machine le 20 Nov 2021
When I plot I obtain this:
.
How can I easily avoid the title superimposing the x10^(-3) by placing any of them in a better position? Tried changing the "Position" argument of the function title() (which has the behavior of the function text()) but I don't know how to put it to work properly since I end up putting titles all over the place but not just increasing its height a bit with respect to the plot. I'd really appreciate your help. Thank you!

Réponse acceptée

Cam Salzberger
Cam Salzberger le 19 Nov 2021
What are you using to position the title so that it comes close to the axes labels there? By default, the title will be center-aligned, so it shouldn't come close. When I use left alignment, the title moves up automatically to get out of the way of the "x10^y":
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing title')
hAx.TitleHorizontalAlignment = 'left';
I guess if it's a really long title, it will get in the way even when center-aligned:
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing really really really really really really really long title')
In that case, you could just make a whitespace sub-title to artificially bump it up. Probably much easier than playing around with position.
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing really really really really really really really long title',' ')
-Cam
  1 commentaire
Turing Machine
Turing Machine le 20 Nov 2021
Thanks! The space subtitle worked for me.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Tags

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by