www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyYAxisTickLabelsForSpecificAxesExample.m

    %% Specify y-Axis Tick Labels for Specific Axes
% Create a figure with two subplots and return the axes objects as |ax1|
% and |ax2|. Plot random data in each subplot. Set the _y_-axis tick values
% and labels for the lower subplot by specifying |ax2| as the first input
% argument.

ax1 = subplot(2,1,1);
plot(rand(3))

ax2 = subplot(2,1,2);
plot(rand(3))
yticks(ax2,[0 .25 .5 .75 1])
yticklabels(ax2,{'y = 0','1/4','1/2','3/4','y = 1'})