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

    %% Modify Contour Plot After Creation
% Plot the contours of $e^{-(x/3)^2-(y/3)^2} + e^{-(x+2)^2-(y+2)^2}$.
% Assign the function contour object to a variable.


f = @(x,y) exp(-(x/3).^2-(y/3).^2) + exp(-(x+2).^2-(y+2).^2);
fc = fcontour(f)
%%
% Change the line width to |1| and the line style to a dashed line by using
% dot notation to set properties of the function contour object. Show
% contours close to |0| and |1| by setting the |LevelList| property. Add a
% colorbar.

fc.LineWidth = 1;
fc.LineStyle = '--';
fc.LevelList = [1 0.9 0.8 0.2 0.1];
colorbar