MATLAB: How to improve the title appearance

figuretitle

Hi, I'd like to improve a bit the general aspect of my graphs, but I don't know much about it. For example, in the following graph:
I don't want to change the size of the picture, but I'd like that the "x 10^6" not to overlap with the title of the graph. A solution that I found was to write the title in the area immediately below the top margin, using
title(['Performance = ' num2str( round(improve,2) ) ' \%'],'interpreter',...
'latex', 'Units', 'normalized', 'Position', [0.5, 0.85, 0])
However, it sometimes overlap with the graph.
Also, I'd like the title to be boxed in a rectangular gray area. Is this possible?

Best Answer

text(0.5, 0.99, ['Performance = ' num2str( round(improve,2) ) ' \%'], ...
'Units', 'normalized', ...
'interpreter', 'latex', ...
'VerticalAlignment', 'top', ...
'BackgroundColor', [0.5,0.5,0.5]);
Instead of estimating the vertical position as 0.85, it is smarter to align the text vertically with "top".