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

    %% Display Grid Lines on Specific Axes
% Create a figure with two subplots and plot a sine wave in each one.

% Copyright 2015 The MathWorks, Inc.

x = linspace(0,10);
y = sin(x);
ax1 = subplot(2,1,1);
plot(x,y)

y2 = sin(3*x);
ax2 = subplot(2,1,2);
plot(x,y2)

%%
% Display the grid lines on the upper subplot.
grid(ax1,'on')