%% Specify Horizontal Line Properties
% Create a horizontal dashed line with a label and a specified line width.

x = -2:0.25:2;
[X,Y] = meshgrid(x);
Z = X.*exp(-X.^2-Y.^2);
contour(X,Y,Z,30)

yl = yline(0,'--','y = 0','LineWidth',3);

%
% Adjust the horizontal alignment and color of the line.

yl.LabelHorizontalAlignment = 'center';
yl.Color = [.80 0 .40];

% Copyright 2018 The MathWorks, Inc.