wordcloud — Create a word cloud chart from text, tokenized documents, bag models, categorical arrays, tables, or word-size data.
wordcloud creates a WordCloudChart compatibility handle. RunMat supports the common MATLAB forms for raw text, tokenizedDocument, bagOfWords, bagOfNgrams, categorical, words with sizeData, and table word/size variables.
Syntax
wc = wordcloud(str)
wc = wordcloud(documents)
wc = wordcloud(bag)
wc = wordcloud(words, sizeData)
wc = wordcloud(tbl, wordVar, sizeVar)
wc = wordcloud(C)
wc = wordcloud(parent, ...)
wc = wordcloud(..., Name, Value)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | Any | Yes | — | Text, tokenizedDocument, bag model, categorical array, or LDA model. |
words | Any | Yes | — | Word vector. |
sizeData | NumericArray | Yes | — | Word size vector. |
tbl | Any | Yes | — | Table with word and size variables. |
wordVar | Any | Yes | — | Table variable containing words. |
sizeVar | Any | Yes | — | Table variable containing word sizes. |
NameValue | Any | Variadic | — | WordCloudChart name-value properties. |
Returns
| Name | Type | Description |
|---|---|---|
wc | NumericScalar | Handle to the WordCloudChart object. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:wordcloud:InvalidArgument | Input data, table selectors, parent axes, or WordCloudChart properties are invalid. | wordcloud: invalid argument |
RunMat:wordcloud:Internal | Internal plotting state update fails while creating or mutating a word cloud. | wordcloud: internal operation failed |
How wordcloud works
wordcloud(str)tokenizes string, character, string-array, or cellstr input, removes common English stop words, counts words, and renders the most frequent words.wordcloud(documents)accepts RunMattokenizedDocumentcompatibility objects and counts tokens from theirDocumentsproperty.wordcloud(bag)accepts RunMatbagOfWordsandbagOfNgramscompatibility objects and sums each column ofCounts; n-gram labels are joined with spaces.wordcloud(words,sizeData)accepts a word vector and a numeric vector with the same element count. Duplicate words are aggregated and zero-sized entries are omitted.wordcloud(tbl,wordVar,sizeVar)accepts RunMat table/timetable compatibility objects wherewordVarandsizeVarare variable names or scalar variable indices.wordcloud(C)accepts RunMat categorical compatibility objects and uses category counts as word sizes.wordcloud(parent,...)accepts a leading RunMat figure parent and uses that figure's active axes for rendering. Encoded axes handles are also accepted as a RunMat plotting compatibility extension.- Supported name-value options are
MaxDisplayWords,Color,HighlightColor,Shape(ovalorrectangle),LayoutNum,SizePower,Title,TitleFontName,Visible,FontName,Box,Units,Position,HandleVisibility,DisplayName, andTag. MaxDisplayWordsis capped at 1000 rendered annotation slots in RunMat to keep chart creation bounded.getsupportsType,Parent,Children,WordData,SizeData,WordVariable,SizeVariable,SourceTable,MaxDisplayWords,Color,HighlightColor,Shape,LayoutNum,SizePower,Title,TitleFontName,FontName,Visible,Box,Units,Position,HandleVisibility,DisplayName, andTag.setsupportsWordData,SizeData,MaxDisplayWords,Color,HighlightColor,Shape,LayoutNum,SizePower,Title,TitleFontName,FontName,Visible,Box,Units,Position,HandleVisibility,DisplayName, andTag;WordDataandSizeDataassignments must preserve matching lengths.- RunMat uses a deterministic annotation layout rather than MATLAB's exact proprietary word-placement algorithm.
FontName,TitleFontName,Units,Position, andHandleVisibilityare stored as chart metadata; the current plotting renderer does not yet expose a separate chart-container layout or font-family path. LDA topic word clouds remain unsupported untilldaModelcompatibility exists and raise an explicit tracked-gap error.
Examples
Create a word cloud from text
txt = "runmat computes fast math and runmat plots math";
wc = wordcloud(txt);Create a word cloud from explicit word sizes
words = ["alpha" "beta" "gamma"];
sizes = [5 9 2];
wc = wordcloud(words, sizes, 'MaxDisplayWords', 2, 'Shape', 'rectangle');
get(wc, 'WordData')Create a word cloud from a table
tbl = table(["alpha";"beta"], [10;4], 'VariableNames', {'Word','Count'});
wc = wordcloud(tbl, 'Word', 'Count');Using wordcloud with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how wordcloud changes the result.
Run a small wordcloud example, explain the result, then change one input and compare the output.
FAQ
Does wordcloud return a graphics object?⌄
Yes. RunMat returns a first-class wordcloud chart handle with readable and mutable chart properties through get and set.
Does RunMat match MATLAB's exact word placement?⌄
No. RunMat computes MATLAB-compatible word labels, sizes, and chart properties, then uses a deterministic annotation layout. Exact MATLAB layout parity remains tracked by the Text Analytics umbrella.
Can wordcloud preserve gpuArray residency?⌄
No. Word clouds are text/chart rendering sinks over host text, table, categorical, and bag metadata, so provider-resident numeric kernels are not applicable to this slice.
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 · cla · clf · 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 · textscatter · textscatter3 · triplot · waitbar · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zoom
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how wordcloud is executed, line by line, in Rust.
- View the source for wordcloud 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.