%% Display Grid Lines in Specific Direction
% Display the grid lines in a particular direction by accessing the Axes object and setting the XGrid, YGrid, and ZGrid properties. Set these properties to either 'on' or 'off'.
% Create a 2-D plot and display the grid lines only in the y direction.

y = rand(10,1);
bar(y)
ax = gca;
ax.XGrid = 'off';
ax.YGrid = 'on';

% Create a 3-D plot and display the grid lines only in the z direction. Use the box on command to show the box outline around the axes.

[X,Y,Z] = peaks;
surf(X,Y,Z)
box on
ax = gca;
ax.ZGrid = 'on';
ax.XGrid = 'off';
ax.YGrid = 'off';

% Copyright 2012 The MathWorks, Inc.