RunMat
GitHub

xline — Draw vertical reference lines on the current axes.

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

How xline works

  • xline(x) adds a vertical reference line at each coordinate in x.
  • 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 dashed threshold line

plot(1:10, rand(1, 10));
xline(5, '--r', 'Threshold');

Expected output:

% Adds a red dashed vertical reference line at x = 5

Add multiple reference lines

plot(1:10, rand(1, 10));
xline([2 5 8], ':');

Expected output:

% Adds three dotted vertical reference lines

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 · yline

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.