www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/AddAxisLabelsExample.m
%% Add Title and Axis Labels to Each Side % Create a chart with two _y_-axes and add a title and axis labels to each % side. % % Load the matrix |hwydata| from the example file |accidents.mat|. % Create a scatter plot of the fifth column in |hwydata| against the left % _y_-axis. Add a title and axis labels. load('accidents.mat','hwydata') ind = 1:51; drivers = hwydata(:,5); yyaxis left scatter(ind,drivers) title('Highway Data') xlabel('States') ylabel('Licensed Drivers (thousands)') %% % Create a second scatter plot of the seventh column in |hwydata| against % the right _y_-axis. Then, label the right _y_-axis. pop = hwydata(:,7); yyaxis right scatter(ind,pop) ylabel('Vehicle Miles Traveled (millions)')