%% Specify Contour Levels and Add Colorbar
% Create multiple slice planes through volumetric data. Draw contours of the data values in each of the slice planes. Specify the levels where you want to draw the contours. Then, add a colorbar.
% Draw contours in three slice planes that are orthogonal to the x-axis at the values -1.2, 0.8, and 2. Draw contours for the volume data between the values -0.2 and 0.4, spaced every 0.01. Add a colorbar to see how the data values map to the contour colors. Also, change the axes view to a 3-D view and add grid lines.

[X,Y,Z] = meshgrid(-2:.2:2);
V = X.*exp(-X.^2-Y.^2-Z.^2);
xslice = [-1.2,0.8,2];   
lvls = -0.2:0.01:0.4;

contourslice(X,Y,Z,V,xslice,[],[],lvls)
colorbar
view(3)
grid on

% Copyright 2012 The MathWorks, Inc.