www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/AddSecondyAxisToSpecificAxesExample.m
%% Add Second _y_-Axis to Specific Axes % Create a figure with two subplots and assign the axes objects to % variables. Add a second _y_-axis to the upper subplot by specifying the % axes object as the first input to |yyaxis|. If you do not specify an axes % object, then |yyaxis| adds a second _y_-axis to the current axes. x = linspace(1,10); ax1 = subplot(2,1,1); yyaxis(ax1,'left') plot(ax1,x,sin(x)) yyaxis(ax1,'right') plot(ax1,x,exp(x)) ax2 = subplot(2,1,2); plot(ax2,1:10)