fill — Create filled 2-D polygon patches.
fill(X,Y,C) creates filled polygonal regions as Patch graphics. Integer coordinate and CData classes remain authoritative on the Patch object; conversion to renderer geometry is an explicit client-side boundary.
Syntax
p = fill(X, Y, C, ..., Name, Value)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
arguments | Any | Variadic | — | One or more X,Y,C groups followed by Patch name/value properties. |
Returns
| Name | Type | Description |
|---|---|---|
p | Any | Patch handle or row vector of patch handles. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:fill:InvalidArgument | Coordinate/color groups, axes targeting, or properties are invalid. | fill: invalid argument |
How fill works
- Equal-length row or column vector X and Y inputs create one region regardless of orientation; matrix inputs create independently addressable regions from columns.
- When either coordinate is a matrix, an equal-length coordinate vector matching the matrix row count is shared across every matrix column; square matrices are grouped by columns.
- Multiple X,Y,C groups create multiple Patch graphics.
- C accepts color text, RGB triples, or numeric indexed color data.
- XData, YData, and CData preserve the original numeric class and shape.
- A leading axes handle targets an existing axes; typed-integer numeric aliases are available only when RunMat extensions are enabled.
Examples
Create a filled triangle
h = fill([0 1 0], [0 0 1], 'red');Expected output:
h is a Patch graphics handleUse exact integer coordinates and indexed color data
h = fill(uint64([0 1 0]), uint64([0 0 1]), uint8(1));Expected output:
get(h,'XData') retains class uint64Create one independently addressable Patch per matrix column
X = uint64([0 2; 1 3; 0 2]);
Y = uint64([0 0; 0 0; 1 1]);
C = uint16([1 4; 2 5; 3 6]);
h = fill(X,Y,C);Expected output:
h is a two-element Patch handle vector; each handle retains its column's typed XData, YData, and CDataUsing fill with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how fill changes the result.
Run a small fill example, explain the result, then change one input and compare the output.
FAQ
Is fill an array-construction function?⌄
No. MATLAB-compatible fill creates Patch graphics. Use createArray to construct constant-valued arrays.
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 · 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 · ylim · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zlim · zoom
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how fill is executed, line by line, in Rust.
- View the source for fill 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.