ylim — Query or set y-axis limits.
ylim([ymin ymax]) sets the y-axis limits, while ylim() returns the current limits as a double vector.
Syntax
limits = ylim()
limits = ylim([ymin ymax])
limits = ylim(mode)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
limits | NumericArray | Yes | — | Two-element numeric vector [ymin ymax]. |
mode | StringScalar | Yes | — | Limit mode string ('auto', 'tight', or 'manual'). |
Returns
| Name | Type | Description |
|---|---|---|
limits | NumericArray | Two-element vector [ymin ymax] or [NaN NaN] when auto. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:ylim:InvalidArgument | Argument count, mode, or limit vector is invalid. | ylim: invalid argument |
RunMat:ylim:Internal | Internal plotting state update fails. | ylim: internal operation failed |
How ylim works
- The two-element limits vector may use single, double, or any native integer class.
- Native integer endpoints are ordered using their exact values before conversion to graphics coordinates.
- Endpoints must be finite, increasing, and remain distinct in the graphics coordinate domain.
- The supported text modes are
'auto','tight', and'manual'.
Examples
Set integer limits
plot(1:10);
ylim(int16([0 12]))Query current limits
limits = ylim()Using ylim with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how ylim changes the result.
Run a small ylim 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
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 · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how ylim is executed, line by line, in Rust.
- View the source for ylim in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
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.