get — Get graphics object properties in MATLAB and RunMat.
get reads properties from graphics handles such as figures, axes, legends, and plot objects. Property names, return forms, and handle behavior follow MATLAB semantics across RunMat graphics objects.
Syntax
value = get(h)
value = get(h, property)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
h | Any | Yes | — | Graphics handle (figure, axes, plot object, text, legend, etc.). |
property | PropertyName | No | — | Property name to query (case-insensitive). |
Returns
| Name | Type | Description |
|---|---|---|
value | Any | Property value or a struct of all readable properties. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:get:InvalidArgument | Handle value or property selector is missing/invalid, or property lookup fails validation. | get: invalid argument |
RunMat:get:Internal | Internal handle/property retrieval fails unexpectedly. | get: internal operation failed |
How get works
get(h)returns a struct of known properties for the handleh.get(h, 'PropertyName')returns a single property value.- The supported property set depends on the handle family: figure, axes, text, legend, and child plot objects each expose different fields.
- RunMat uses
getto surface subplot-local state such as limits, scale modes, legend visibility, and text metadata. - The handle families covered by
getnow extend across the major plot families rather than just the most recently added plotting builtins.
Examples
Inspect the full property struct for a line handle
h = plot(1:5, [1 4 2 5 3]);
props = get(h);Read an axes-local property
ax = subplot(1, 2, 2);
semilogx(logspace(0, 2, 50), logspace(0, 2, 50));
set(ax, 'FontSize', 12);
get(ax, 'FontSize')Expected output:
ans =
12Inspect a legend handle after creation
plot(1:5, 1:5);
lg = legend('series');
get(lg, 'Orientation')Using get with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how get changes the result.
Run a small get example, explain the result, then change one input and compare the output.
FAQ
How do I see all available properties on a handle?⌄
Call get(h) with no property name. It returns a struct containing every known property for that handle type. This is the fastest way to discover what's queryable on a line, axes, legend, or text object.
Can I query properties on axes handles, not just plot objects?⌄
Yes. get(gca, 'XScale') reads the x-axis scale mode, get(gca, 'View') reads the camera angle, get(gca, 'FontSize') reads the axes tick-label font size, and so on. Axes handles, legend handles, text handles, and plot-child handles all go through the same get interface.
What happens if I query a property that doesn't exist?⌄
RunMat raises a plotting error rather than returning empty or silently succeeding. If you're unsure whether a property exists, call get(h) first to inspect the full property struct.
Related Plotting functions
More plotting resources
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how get is executed, line by line, in Rust.
- View the source for get 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.