RunMat
GitHub

yline — Draw horizontal reference lines on the current axes.

yline adds one or more horizontal reference lines to the current axes. It accepts scalar or vector y-coordinates, MATLAB line specs, labels, and common line name/value styling such as Color, LineStyle, LineWidth, and DisplayName.

How yline works

  • yline(y) adds a horizontal reference line at each coordinate in y.
  • Reference lines append to the current axes without replacing existing plot content.
  • Line spans follow the active axes limits, including later xlim and ylim changes.
  • The returned handle supports get and set for Value, Color, LineWidth, LineStyle, Label, LabelOrientation, DisplayName, and Visible.

Examples

Add a zero baseline

plot(-5:5, (-5:5).^2 - 10);
yline(0, 'k', 'LineWidth', 1);

Expected output:

% Adds a black horizontal reference line at y = 0

Label a baseline

plot(1:10, rand(1, 10));
yline(0.5, ':', 'Baseline', 'LabelOrientation', 'horizontal');

Expected output:

% Adds a dotted labeled horizontal reference line

2D Charts

area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem

3D & Surface

contour · contourf · mesh · meshc · plot3 · quiver · scatter3 · surf · surfc

Images

image · imagesc · imshow

Axes & Layout

axis · box · grid · sgtitle · subplot · title · view · zlabel

Appearance

colorbar · colormap · legend · shading

Handle Access

gca · gcf · get · set

Other

cla · clf · figure · hold · xline

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat for free

Write code or describe what you want to compute. The sandbox is free, no account required.