xscale — Query or set the X-axis scale for the current axes or a specified axes handle.

xscale controls whether the X axis is displayed on a linear or logarithmic scale. It supports query, explicit scale assignment, command-form style string arguments, and explicit axes-target forms.

Syntax

scale = xscale()
xscale(scale)
xscale(ax, scale)

Inputs

NameTypeRequiredDefaultDescription
scaleStringScalarYesScale string: 'linear' or 'log'.
axAxesHandleYesTarget axes handle.

Returns

NameTypeDescription
scaleStringScalarCurrent X-axis scale, 'linear' or 'log'.

Errors

IdentifierWhenMessage
RunMat:xscale:InvalidArgumentArgument count, scale value, or axes handle is invalid.xscale: invalid argument
RunMat:xscale:InternalInternal plotting state update fails.xscale: internal operation failed

GPU memory and residency

xscale reads and writes axes metadata. The renderer applies log mapping in its direct GPU coordinate path without gathering GPU-resident plot data.

Examples

Switch the X axis to logarithmic scale

plot(1:1000, log10(1:1000));
xscale('log');
xscale()

Expected output:

ans = 'log'

Apply scale to a specific subplot

ax = subplot(1, 2, 2);
plot(ax, 1:100, rand(1, 100));
xscale(ax, 'log');

Expected output:

% Only the target axes receives logarithmic X scaling

Using xscale with coding agents

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

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

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.