%% Change Alignment of Title and Subtitle
% Create a plot and add a title and a subtitle. Get the current axes, and align the title and subtitle to the left edge of the plot box by setting the TitleHorizontalAlignment property on the axes to 'left'.

plot([0 2],[1 5])
title('Straight Line')
subtitle('Slope = 2, y-Intercept = 1')
ax = gca;
ax.TitleHorizontalAlignment = 'left';

%
% Center the title and subtitle by setting the TitleHorizontalAlignment property on the axes to 'center'.

ax.TitleHorizontalAlignment = 'center';

% Copyright 2020 The MathWorks, Inc.