%% Display Grid Lines in Single Direction
% This example shows how to display grid lines in a single direction by
% setting axes properties. The |grid on| command sets the |XGrid|, |YGrid|,
% and |ZGrid| axes properties. The |grid minor| command sets the
% |XMinorGrid|, |YMinorGrid|, and |ZMinorGrid| properties. Control the
% display of the grid lines for each individual axes by setting these
% axes properties directly.

% Copyright 2015 The MathWorks, Inc.


%%
% Display the grid lines in the _x_-direction, but not in the _y_-direction
% by setting the |XGrid| axes property to |'on'| and the |YGrid| axes
% property to |'off'|. Starting in R2014b, you can use dot notation to set
% properties. If you are using an earlier release, use the
% <docid:matlab_ref.f67-432995> function instead.
x = -10:10;
y = x.^2;
plot(x,y)

ax = gca;
ax.XGrid = 'on';
ax.YGrid = 'off';

%%
% Display the minor grid lines in the _x_-direction, but not in the
% _y_-direction by setting the |XGridMinor| axes property to |'on'| and the
% |YGridMinor| axes property to |'off'|.

ax.XMinorGrid = 'on';
ax.YMinorGrid = 'off';

