how to have the same plot area size when some axis names become 2 lines

3 views (last 30 days)
I am generating plots with different axis names, and when long names become 2 lines they make the plot area smaller, but I need the plot area to be the same for all my plots.
P.S. each plot is plotted separately, not at once.

Accepted Answer

Walter Roberson
Walter Roberson on 12 Feb 2020
You could control InnerPosition property and OuterPosition property to force all of the plots to have the smaller size so that both have room for the words. There would be empty space in the one-line case but the area would be consistent.
Or you could detect the long line case and set the fontsize smaller

More Answers (2)

KSSV on 12 Feb 2020
Edited: KSSV on 12 Feb 2020
Use like this:
title({'First line';'Second line'})
xlabel({'First line';'Second line'})
ylabel({'First line';'Second line'})

Asliddin Komilov
Asliddin Komilov on 13 Feb 2020
Ok having two lines in the axis name does the job, thanks

Community Treasure Hunt

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

Start Hunting!