set — Set figure, axes, and graphics-object properties through handle workflows.
set applies property/value pairs to figure, axes, legend, text, and plot-child handles. Accepted properties and classes are owned by each graphics object; unsupported-property handling still differs among legacy plot-child setters.
Syntax
set(h, property, value, ...)
status = set(h, property, value, ...)Inputs
h- Type
Any- Required
- Yes
- Description
- Live figure, axes, plot, text, or legend handle.
pairs- Type
Any- Required
- Variadic
- Description
- One or more property/value pairs.
Returns
status- Type
StringScalar- Description
- Returns `ok` when property updates succeed.
Errors
RunMat:set:InvalidArgument- When
- A handle, property-name shape, property/value pair, or owner-validated value is invalid. Some legacy plot-child setters still ignore unsupported style names or values.
- Message
set: invalid argument
RunMat:set:Internal- When
- Graphics update or source-data readback fails after admission.
- Message
set: internal operation failed
Behavior
set(h, 'Property', value, ...) requires a handle followed by one or more property/value pairs. The status output is ok on success; a call without an assigned output still performs the update.
Axes-local state includes limits, logarithmic modes, grid and legend visibility, and font size. Child plots support line width, display names, markers, and data coordinates. Legend and text handles use the same public property surface.
Integer acceptance is property-specific. Numeric widths, sizes, limits, positions, and counts validate native integer values at their named boundary; text and enum properties still require text.
For line, scatter, and 3-D line data, coordinate values and selected controls are validated before one guarded plot-element update. Some style setters still ignore unsupported values or names; style admission is not yet uniform. Other graphics families retain their owning setter behavior, and a single call is not a general transaction across independent objects.
Execution and source data
Plot-child updates can read plotting-owned GPU source coordinates before changing data or styles. Such readback may suspend and preserves the original provider error cause. It is a graphics-state operation, not an array GPU kernel or an implicit upload.
The plot source is snapshotted with its lease before readback. If the figure or child changes while the readback is pending, the guarded update fails without publishing stale coordinates. Dropping an unpolled call makes no change.
Examples
Style a plotted line
h = plot(0:0.1:1, (0:0.1:1).^2);
set(h, 'Color', 'r', 'LineWidth', 2, 'DisplayName', 'quadratic');Change axes-local state
ax = subplot(1, 2, 2);
plot(1:5, [2 3 5 4 1]);
set(ax, 'XScale', 'log', 'Grid', false, 'FontSize', 12);Change legend placement and orientation
plot(1:5, 1:5);
lg = legend('series');
set(lg, 'Location', 'southwest', 'Orientation', 'horizontal');Using set with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how set changes the result.
Run a small set example, explain the result, then change one input and compare the output.
FAQ
Can I set multiple properties in one call?⌄
Yes. Pass alternating property/value pairs, such as set(h,'Color','r','LineWidth',2). The line, scatter, and 3-D line owner validates coordinates and selected controls before one guarded plot update; style validation and other handle families are not uniformly transactional.
Which line properties are common?⌄
Color, LineWidth, LineStyle, Marker, and DisplayName cover typical styling. DisplayName feeds the legend when it is created without explicit labels. For example, create the line with h = plot(x,y);, then use set(h,'Color',[0.2 0.6 0.8],'LineWidth',1.5,'DisplayName','measured').
What if a property is unsupported?⌄
Property availability depends on the handle family; inspect get(h) first. Many owners report an error, but some legacy plot-child setters currently ignore unknown names, so do not rely on a uniform rejection guarantee.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · autumn · axes · barh · bone · caxis · cla · clf · clim · colorcube · colororder · cool · copper · copyobj · cylinder · daspect · datacursormode · dataTipTextRow · drawnow · fcontour · figure · fill · fill3 · findobj · fsurf · gobjects · gray · groot · hgload · hgsave · hidden · histogram2 · hold · hot · inferno · isgraphics · ishandle · jet · line · lines · linkaxes · magma · openfig · opengl · pan · parula · patch · pink · plasma · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · spring · stackedplot · subtitle · summer · suptitle · text · textscatter · textscatter3 · triplot · turbo · viridis · waitbar · winter · wordcloud · xlabel · xlim · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · ylabel · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom
More plotting resources
Source you can read
Every RunMat function's source is public. Read exactly how set is executed, line by line, in Rust.
- View the source for set in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.