www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgsurfview/@contourplot/plot.m

    function plot(obj, data)
%PLOT Draws a contour plot
%
%  Data is an instance of cgsurfview.svdata
%
% The layout is in two rows.  The top row contains the axes.
% The bottom row contains two controls.  From right to left:
%   "hCheckBox": a checkbox, reading "Automatically choose contour values".  When
%         selected, contours are drawn at the default values.  When
%         unselected, the user can change the contour values using:
%   "hButton": a pushbutton, reading "Set Contour Values".  When the user
%         clicks on this, a ValueEditor is shown, and the user can enter
%         the values at which to draw contours.

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.


cursormode = false;
if ~isempty(obj.hCursorLines)
    obj.hCursorLines = [];
    cursormode = true;
end

if get(obj.hCheckBox,'Value')
    % We are automatically choosing contour values, so
    % discard the old ones and specify the number of lines instead
    obj.contour_values = obj.PlotOptions.numlines;
end

% Call ndgrid on the input values and store the results
[obj.xdata, obj.ydata] = ndgrid(...
    data.getVariableValues(1),...
    data.getVariableValues(2));
% Store the plot data for later
obj.PlotData = data;

% Do the plotting
obj.pReplot;

% set X-axis label
set(get(obj.hAxes,'XLabel'),'String',data.getVariableName(1),'Interpreter','none');

% set Y-axis label
set(get(obj.hAxes,'YLabel'),'String',data.getVariableName(2),'Interpreter','none');

if cursormode
    obj.setCursorMode('on');
end