RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • addpoints
    • ancestor
    • animatedline
    • area
    • axes
    • axis
    • bar
    • barh
    • box
    • caxis
    • cla
    • clf
    • clim
    • colorbar
    • colorcube
    • colormap
    • colororder
    • contour
    • contour3
    • contourf
    • copyobj
    • daspect
    • datacursormode
    • dataTipTextRow
    • errorbar
    • fcontour
    • figure
    • fill
    • fill3
    • findobj
    • fsurf
    • gca
    • gcf
    • get
    • gobjects
    • grid
    • groot
    • heatmap
    • hgload
    • hgsave
    • hidden
    • hist
    • histogram
    • histogram2
    • hold
    • image
    • imagesc
    • imshow
    • legend
    • line
    • linkaxes
    • loglog
    • mesh
    • meshc
    • openfig
    • opengl
    • pan
    • parula
    • patch
    • pie
    • plot
    • plot3
    • plotmatrix
    • plotyy
    • polarhistogram
    • polarplot
    • polarscatter
    • print
    • quiver
    • quiver3
    • ribbon
    • saveas
    • savefig
    • scatter
    • scatter3
    • semilogx
    • semilogy
    • set
    • sgtitle
    • shading
    • sphere
    • stackedplot
    • stairs
    • stem
    • subplot
    • subtitle
    • suptitle
    • surf
    • surfc
    • text
    • textscatter
    • textscatter3
    • title
    • triplot
    • view
    • waitbar
    • wordcloud
    • xlabel
    • xlim
    • xline
    • xscale
    • xtickangle
    • xtickformat
    • xticklabels
    • xticks
    • ylabel
    • ylim
    • yline
    • yscale
    • ytickangle
    • ytickformat
    • yticklabels
    • yticks
    • zlabel
    • zlim
    • zoom

yline — Draw horizontal reference lines on current or specified axes with MATLAB-compatible styling forms.

yline adds one or more horizontal reference lines with optional labels, line specs, and name-value styling, following MATLAB-compatible plotting behavior.

Syntax

h = yline(y)
h = yline(y, styleOrLabel)
h = yline(y, LineSpec, label)
h = yline(y, Name, Value, ...)

Inputs

NameTypeRequiredDefaultDescription
yNumericArrayYes—Y-coordinate scalar or numeric vector of horizontal line positions.
style_or_labelAnyNo—LineSpec token (for example '--r') or label text.
linespecStyleSpecYes—Line style token (for example '--r').
labelStringScalarYes—Reference line label text.
propsAnyVariadic—Style arguments and Name/Value pairs (Color, LineWidth, LineStyle, LabelOrientation, Visible).

Returns

NameTypeDescription
hNumericArrayReference line handle scalar or row vector when multiple coordinates are provided.

Errors

IdentifierWhenMessage
RunMat:yline:InvalidArgumentCoordinate input, style arguments, or Name/Value pairs are invalid.yline: invalid argument
RunMat:yline:InternalInternal plotting state update fails.yline: internal operation failed

How yline works

  • yline(y) adds a horizontal reference line at each coordinate in y. Coordinates may use any native integer class and cross to the graphics coordinate domain after validation.
  • 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.
  • Integer RGB components must be zero or one, integer line widths must be positive, and numeric Visible values must be exactly zero or one.

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

Rendered yline example

time = 0:0.2:10;
current = 7.2 + 0.35*time + 0.9*sin(1.3*time);
limit = 11;

plot(time, current, 'LineWidth', 2);
yline(limit, '--r', 'Operating limit', 'LineWidth', 1.5);
title('Motor Current During Ramp');
xlabel('Time (s)');
ylabel('Current (A)');
grid on;
Expected output:
Motor-current time series with a horizontal MATLAB yline marking the operating limit in RunMat

Compare this result with other chart types in the MATLAB Plot Gallery.

Using yline with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how yline changes the result.

Run a small yline example, explain the result, then change one input and compare the output.

Related Plotting functions

2D Charts

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

3D & Surface

contour · contour3 · 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

addpoints · ancestor · animatedline · axes · barh · caxis · cla · clf · clim · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · parula · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · text · textscatter · textscatter3 · triplot · waitbar · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How yline works
  • Examples
  • Add a zero baseline
  • Label a baseline
  • Rendered yline example
  • Using yline with coding agents
  • Related Plotting functions
  • 2D Charts
  • 3D & Surface
  • Images
  • Axes & Layout
  • Appearance
  • Handle Access
  • Other
  • About RunMat